Skip to main content
Module

x/math/mod.ts

Deno module for high-precision calculations and scientific computing
Latest
import * as math from "https://deno.land/x/math@v1.1.0/mod.ts";

Functions

Returns the absolute value of a numberic

Returns a numeric whose value is the value of dividend divided by divisor. If the result has more fraction digits than is specified by Big.DP, it will be rounded to Big.DP decimal places using rounding mode Big.RM. Throws if divisor is zero or otherwise invalid.

Returns true if a equals b, otherwise returns false. Throws if a or b is invalid.

Generating a diagonal matrix

Returns true if a greater than b, otherwise returns false. Throws if a or b is invalid.

Returns true if a greater than or equal to b, otherwise returns false. Throws if a or b is invalid.

Generating a diagonal matrix

Returns true if a less than b, otherwise returns false. Throws if a or b is invalid.

Returns true if a less than or equal to b, otherwise returns false. Throws if a or b is invalid.

Returns the larger of a set of supplied numeric expressions

Returns the smaller of a set of supplied numeric expressions.

Returns numeric whose value is the value of minuend minus subtrahend. Throws if minuend or subtrahend is invalid.

Returns numeric whose value is the value of a modulo b. it will match that of JavaScript's % operator i.e. the integer remainder of dividing a by b. Throws if a or b is negative or otherwise invalid.

Returns numeric whose value is the value of a plus b. Throws if a or b is invalid.

Returns a numeric whose value is the value of value raised to the power n. If n is negative and the result has more fraction digits than is specified by Big.DP, it will be rounded to Big.DP decimal places using rounding mode Big.RM. Throws if n is invalid.

Returns numeric whose value is the value of value rounded using rounding mode rm to a maximum of dp decimal places or if dp is negative, rounded to an integer which is a multiple of 10**-dp. Throws if dp or rm is invalid.

Returns a numeric whose value is the square root of value. If the result has more fraction digits than is specified by Big.DP, it will be rounded to Big.DP decimal places using rounding mode Big.RM. Throws if this value is negative.

Returns a numeric whose value is the sum of values. Throws if this values contains a invalid numeric.

Returns a numeric whose value is the value of multiplicand times multiplier. Throws if multiplicand or multiplier is invalid.

Returns a string representing the value of value in exponential notation to a fixed number of dp decimal places. Throws if value or dp is invalid.

Returns a string representing the value of value in normal notation to a fixed number of dp decimal places. If the value of value in normal notation has more digits to the right of the decimal point than is specified by dp, the return value will be rounded to dp decimal places using rounding mode Big.RM. If the value of value in normal notation has fewer fraction digits then is specified by dp, the return value will be appended with zeros accordingly. Unlike Number.prototype.toFixed, which returns exponential notation if a number is greater or equal to 1021, this method will always return normal notation. Throws if value or dp is invalid.

Returns a string representing the value of value to the specified number of sd significant digits. If the value of value has more digits than is specified by sd, the return value will be rounded to sd significant digits using rounding mode Big.RM. If the value of value has fewer digits than is specified by sd, the return value will be appended with zeros accordingly. If sd is less than the number of digits necessary to represent the integer part of the value in normal notation, exponential notation is used. If sd is omitted or is undefined, the return value is the same as .toString().