Expand description
Exact numbers: rationals of any integer type, such as BigRational, which is Ratio<BigInt>. These functions give exact results, where the float functions round. linalg::exact solves matrices of them, polynomial evaluates polynomials with them, and number_theory works on whole numbers.
Functions§
- binom
- The binomial coefficient C(n, k) for a rational
nand a wholek, with J’s extension to negativek. For a wholenfrom 0, akabovengives 0. A negativekgives 0, unlessnis a whole number withk ≤ n < 0, where the result is (-1)^(n-k) C(-k-1, n-k). Otherwise the result is the product of (n-i)/(i+1) for eachifrom 0 belowk. It checks for an interrupt once every 1,024 steps of that product. - divide
- factorial
- floor_
divide - gcd
- The greatest common divisor of
xandy: the largest rational that divides each a whole number of times. It is the gcd of their numerators over the lcm of their denominators. It is never negative, and the gcd of 0 and 0 is 0. - lcm
- The least common multiple of
xandy,x y / gcd(x, y), with the sign ofx y. It is 0 where either is 0. - power
- residue
ymoduloxwith the sign ofx,y - x⌊y/x⌋, which APL writesx|y. A zeroxgivesy.