math.clamp
Clamp an integer to an inclusive range, refusing a range whose bounds are the wrong way round.
clamp in TypeScript
1.0.0
py rs ts
12 tests
Apache-2.0
math.round-div
Integer division with an explicit rounding mode, for money arithmetic that must not drift.
roundDiv in TypeScript
1.0.0
py rs ts
14 tests
Apache-2.0
math.rational
Exact fraction arithmetic, always reduced, for rates and ratios that must not drift.
A group of 8: calculateRational, rational, addRational, subtractRational, multiplyRational, divideRational, compareRational, rationalToInteger
2.0.0
py rs ts
86 tests
Apache-2.0
math.gcd-lcm
Greatest common divisor and least common multiple of two integers, exactly and without overflow.
A group of 3: gcdLcm, gcd, lcm
2.0.0
py rs ts
39 tests
Apache-2.0
math.sin-cos
Sine and cosine of an angle in radians from + - * / only, so every language returns the same doubles.
sinCos in TypeScript
1.0.1
py rs ts
10 tests
Apache-2.0
math.exp
e to the power x from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
exp in TypeScript
1.0.1
py rs ts
10 tests
Apache-2.0
math.ln
Natural logarithm from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
ln in TypeScript
1.0.1
py rs ts
11 tests
Apache-2.0
math.basis-points
Convert a rate between percent, basis points and a plain ratio exactly, as decimal text or integer basis points.
A group of 3: convertRate, toBasisPoints, fromBasisPoints
2.0.0
py rs ts
45 tests
Apache-2.0
math.atan
Arctangent in radians from + - * / only (fdlibm's method), so every language returns the same double.
atan in TypeScript
1.0.1
py rs ts
22 tests
Apache-2.0
math.pow
base to the power exponent from + - * / only, exact by squaring for whole exponents, identical in every language.
pow in TypeScript
1.0.0
py rs ts
16 tests
Apache-2.0
math.round-float
Round a float half away from zero to 0-12 decimal places, identically in TypeScript, Python and Rust.
roundFloat in TypeScript
1.0.0
py rs ts
22 tests
Apache-2.0
math.fractional-power
Raise a positive decimal to a fractional power, (1.199)^(31/365), identically in every language.
fractionalPower in TypeScript
1.0.0
py rs ts
19 tests
Apache-2.0
math.big-integer
Exact integer arithmetic of any size, on decimal strings, for powers and products that overflow 64 bits.
calculateBigInteger in TypeScript
1.0.0
py rs ts
24 tests
Apache-2.0
math.integer-sqrt
Exact integer square root: the largest whole number whose square does not exceed n.
integerSqrt in TypeScript
1.0.0
py rs ts
11 tests
Apache-2.0
math.percent-change
Percentage change from one value to another, in basis points, with an explicit rounding mode.
percentChange in TypeScript
1.0.0
py rs ts
19 tests
Apache-2.0
math.round-div-big
Divide two integers of any size with an explicit rounding mode, on decimal strings, for exact money sums past 2^53.
roundDivBig in TypeScript
1.0.0
py rs ts
21 tests
Apache-2.0