Module Js.Math

Provide bindings for JS Math object

JavaScript Math API

let _E: float;

Euler's number

let _LN2: float;

natural logarithm of 2

let _LN10: float;

natural logarithm of 10

let _LOG2E: float;

base 2 logarithm of E

let _LOG10E: float;

base 10 logarithm of E

let _PI: float;

Pi... (ratio of the circumference and diameter of a circle)

let _SQRT1_2: float;

square root of 1/2

let _SQRT2: float;

square root of 2

let abs_int: int => int;

absolute value

let abs_float: float => float;

absolute value

let acos: float => float;

arccosine in radians, can return NaN

let acosh: float => float;

hyperbolic arccosine in raidans, can return NaN, ES2015

let asin: float => float;

arcsine in radians, can return NaN

let asinh: float => float;

hyperbolic arcsine in raidans, ES2015

let atan: float => float;

arctangent in radians

let atanh: float => float;

hyperbolic arctangent in radians, can return NaN, ES2015

let atan2: y:float => x:float => float;

arctangent of the quotient of x and y, mostly... this one's a bit weird

let cbrt: float => float;

cube root, can return NaN, ES2015

let unsafe_ceil_int: float => int;

may return values not representable by int

let ceil_int: float => int;

smallest int greater than or equal to the argument

let ceil_float: float => float;

smallest float greater than or equal to the argument

let clz32: int => int;

number of leading zero bits of the argument's 32 bit int representation, ES2015

let cos: float => float;

cosine in radians

let cosh: float => float;

hyperbolic cosine in radians, ES2015

let exp: float => float;

natural exponentional

let expm1: float => float;

natural exponential minus 1, ES2015

let unsafe_floor_int: float => int;

may return values not representable by int

let floor_int: float => int;

largest int greater than or equal to the arugment

let floor_float: float => float;
let fround: float => float;

round to nearest single precision float, ES2015

let hypot: float => float => float;

pythagorean equation, ES2015

let hypotMany: array(float) => float;

generalized pythagorean equation, ES2015

let imul: int => int => int;

32-bit integer multiplication, ES2015

let log: float => float;

natural logarithm, can return NaN

let log1p: float => float;

natural logarithm of 1 + the argument, can return NaN, ES2015

let log10: float => float;

base 10 logarithm, can return NaN, ES2015

let log2: float => float;

base 2 logarithm, can return NaN, ES2015

let max_int: int => int => int;

max value

let maxMany_int: array(int) => int;

max value

let max_float: float => float => float;

max value

let maxMany_float: array(float) => float;

max value

let min_int: int => int => int;

min value

let minMany_int: array(int) => int;

min value

let min_float: float => float => float;

min value

let minMany_float: array(float) => float;

min value

let pow_float: base:float => exp:float => float;

base to the power of the exponent

let random: unit => float;

random number in [0,1)

let random_int: int => int => int;

random number in [min,max)

let unsafe_round: float => int;

rounds to nearest integer, returns a value not representable as int if NaN

let round: float => float;

rounds to nearest integer

let sign_int: int => int;

the sign of the argument, 1, -1 or 0, ES2015

let sign_float: float => float;

the sign of the argument, 1, -1, 0, -0 or NaN, ES2015

let sin: float => float;

sine in radians

let sinh: float => float;

hyperbolic sine in radians, ES2015

let sqrt: float => float;

square root, can return NaN

let tan: float => float;

tangent in radians

let tanh: float => float;

hyperbolic tangent in radians, ES2015

let unsafe_trunc: float => int;

truncate, ie. remove fractional digits, returns a value not representable as int if NaN, ES2015

let trunc: float => float;

truncate, ie. remove fractional digits, returns a value not representable as int if NaN, ES2015