Skip to main content

Module exact

Module exact 

Source
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 n and a whole k, with J’s extension to negative k. For a whole n from 0, a k above n gives 0. A negative k gives 0, unless n is a whole number with k ≤ 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 each i from 0 below k. It checks for an interrupt once every 1,024 steps of that product.
divide
factorial
floor_divide
gcd
The greatest common divisor of x and y: 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 x and y, x y / gcd(x, y), with the sign of x y. It is 0 where either is 0.
power
residue
y modulo x with the sign of x, y - x⌊y/x⌋, which APL writes x|y. A zero x gives y.