Mathematics
Documentation for the %base desk's /lib/math.hoon library, which contains mathematical operations.
/lib/math is a standard library which lives outside of the /sys kernel and supports userspace applications which need transcendental mathematical constants and operators. /lib/math is not currently subject to kelvin versioning.
Like Lagoon, /lib/math is intended to support general-purpose linear algebraic types, but at this point it focuses on integers and IEEE 754 floating-point numbers.
Like the basic floating-point support in Hoon, /lib/math is divided into doors along the lines of the supported data types. At the current time, it supports:
+rh, half-precision (16-bit) floating-point numbers.+rs, single-precision (32-bit) floating-point numbers.+rd, double-precision (64-bit) floating-point numbers.+rq, quadruple-precision (128-bit) floating-point numbers.
+rs
+rsSingle-precision IEEE 754 mathematical operations.
A container core for operations related to single-precision binary floats.
+rs has four rounding modes: round to nearest (%n), round up (%u), round down (%d), and round to zero (%z). The default rounding mode is %z. If you need a different rounding mode, you'd do something like =/ rs-n ~(. rs [%n rtol]) and then call the arms of your modified version instead.
+rs supports a relative tolerance for precision of operations, which is set by the rtol parameter. The default value is _.1e-5, but you can change it by passing a different value in the rs door.
Source
++ rs
^|
|_ $$: r=$?(%n %u %d %z) :: round nearest, up, down, to zero
rtol=_.1e-5 :: relative tolerance for precision of operations
==+tau
+tauThe value (OEIS A019692), radian angle measure of a full turn.
Produces
The value of tau or 2 pi , radian angle measure of a full turn, represented as a single-precision floating-point atom.
Source
+pi
+piThe value pi (OEIS A000796), radian angle measure of a half turn.
Produces
The value of pi , radian angle measure of a half turn, represented as a single-precision floating-point atom.
Source
+e
+eReturn the value e (Euler's constant) (OEIS A001113).
Produces
The value of e, represented as a single-precision floating-point atom.
Source
+phi
+phiThe value phi (golden ratio) (OEIS A001622).
Produces
The value of phi, represented as a single-precision floating-point atom.
Source
+sqt2
+sqt2The value sqrt(2) (OEIS A002193).
Produces
The value of sqrt(2), represented as a single-precision floating-point atom.
Source
+invsqt2
+invsqt2The value 1/sqrt(2) (OEIS A010503).
Produces
The value of 1/sqrt(2), represented as a single-precision floating-point atom.
Source
+log2
+log2The value log(2) (OEIS A002162).
Produces
The value of log(2), represented as a single-precision floating-point atom.
Source
+invlog2
+invlog2The value 1/log(2).
Produces
The value of 1/log(2), represented as a single-precision floating-point atom.
Source
+log10
+log10The value log(10) (OEIS A002392).
Produces
The value of log(10), represented as a single-precision floating-point atom.
Source
+huge
+hugeThe value of the largest representable number.
Produces
The value of the largest representable number, represented as a single-precision floating-point atom.
Source
+tiny
+tinyThe value of the smallest representable normal number.
Produces
The value of the smallest representable normal number, represented as a single-precision floating-point atom.
Source
+sea
+seaFloating-point atom representation.
Accepts
A floating-point atom (@rs).
Produces
The $fn representation of the floating-point atom.
Source
+bit
+bitFloating-point atom representation.
Accepts
The $fn representation of a floating-point atom.
Produces
A floating-point atom (@rs).
Source
+sun
+sunFloating-point atom of an unsigned integer atom.
Accepts
An unsigned integer atom (@ud).
Produces
A floating-point atom (@rs).
Source
+san
+sanFloating-point atom of a signed integer atom.
Accepts
A signed integer atom (@sd).
Produces
A floating-point atom (@rs).
Source
+exp
+expThe value of e^x for a given floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Source
+toi
+toiThe unitized signed integer atom of a rounded floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A unitized signed integer atom (@sd).
Source
+drg
+drgThe decimal form of a floating-point atom using the Dragon4 algorithm.
Accepts
A floating-point atom (@rs).
Produces
A decimal form (+dn).
Source
+grd
+grdThe floating-point atom of a decimal form. Inverse of +drg.
Accepts
A decimal form (+dn).
Produces
A floating-point atom (@rs).
Source
+lth
+lthThe comparison of two floating-point atoms, less than.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+lte
+lteThe comparison of two floating-point atoms, less than or equal to.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+leq
+leqThe comparison of two floating-point atoms, less than or equal to. Alias for +lte.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+equ
+equThe comparison of two floating-point atoms, equal to.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+gth
+gthThe comparison of two floating-point atoms, greater than.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+gte
+gteThe comparison of two floating-point atoms, greater than or equal to.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+geq
+geqThe comparison of two floating-point atoms, greater than or equal to. Alias for +gte.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+neq
+neqThe comparison of two floating-point atoms, not equal to.
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+is-close
+is-closeThe comparison of two floating-point atoms, within a relative tolerance (provided by the +rs door).
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+all-close
+all-closeThe comparison of a floating-point atom to a list of floating- point atoms, within a relative tolerance (provided by the +rs door).
Accepts
A pair of floating-point atoms (@rs).
Produces
A $flag.
Source
+is-int
+is-intReturns whether a floating-point value is an integer (no fractional part).
Accepts
A floating-point atom (@rs).
Produces
A $flag.
Source
+add
+addThe sum of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rs).
Produces
A floating-point atom (@rs).
Source
+sub
+subThe difference of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rs).
Produces
A floating-point atom (@rs).
Source
+mul
+mulThe product of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rs).
Produces
A floating-point atom (@rs).
Source
+div
+divThe quotient of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rs).
Produces
A floating-point atom (@rs).
Source
+mod
+modThe modulus of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rs).
Produces
A floating-point atom (@rs).
Source
+fma
+fmaThe fused multiply-add of three floating-point atoms.
Accepts
A triplet of floating-point atoms (@rs).
Produces
A floating-point atom (@rs).
Source
+sig
+sigThe sign of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A $flag.
Source
+sgn
+sgnThe sign of a floating-point atom. Alias for +sig.
Accepts
A floating-point atom (@rs).
Produces
A $flag.
Source
+neg
+negThe negation of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Source
+factorial
+factorialThe factorial of a floating-point atom. Assumes integer input.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Source
+abs
+absThe absolute value of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Source
+exp
+expThe exponential of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+sin
+sinThe sine of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+cos
+cosThe cosine of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+tan
+tanThe tangent of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+asin
+asinThe inverse sine of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+acos
+acosThe inverse cosine of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Examples
Source
+atan
+atanThe inverse tangent of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+atan2
+atan2The inverse tangent of a floating-point coordinate.
Accepts
A pair of floating-point atoms (@rs), representing the y and x coordinates.
Produces
A floating-point atom (@rs).
Examples
Source
+pow-n
+pow-nThe power of a floating-point atom to an integer exponent.
Accepts
A pair of floating-point atoms (@rs), representing the base and the exponent.
Produces
A floating-point atom (@rs).
Examples
Source
+log
+logThe natural logarithm of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+log-10
+log-10The base-10 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+log-2
+log-2The base-2 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+pow
+powThe power of a floating-point atom to a floating-point exponent.
Accepts
A pair of floating-point atoms (@rs), representing the base and the exponent.
Produces
A floating-point atom (@rs).
Examples
Source
+sqrt
+sqrtThe square root of a floating-point atom. Alias for +sqt.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+sqt
+sqtThe square root of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+cbrt
+cbrtThe cube root of a floating-point atom. Alias for +cbt. ]
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+cbt
+cbtThe cube root of a floating-point atom.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+arg
+argThe argument of a floating-point atom (real argument = absolute value).
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+round
+roundThe floating-point atom rounded to a given number of decimal places.
Accepts
A pair of floating-point atom (@rs) and an unsigned integer atom (@ud), where the integer specifies the number of significant digits to round to.
Produces
A floating-point atom (@rs).
Examples
Discussion
This is exceptionally sensitive to off-by-one FP rounding error.
Source
+round-places
+round-placesThe floating-point atom rounded to a given number of decimal places.
Accepts
A pair of floating-point atom (@rs) and an unsigned integer atom (@ud), where the integer specifies the number of significant digits to round to.
Produces
A floating-point atom (@rs).
Examples
Discussion
This is exceptionally sensitive to off-by-one FP rounding error.
Source
+round-bankers
+round-bankersThe floating-point atom rounded to the nearest integer, with ties rounded to the nearest even integer.
Accepts
A floating-point atom (@rs).
Produces
A floating-point atom (@rs).
Examples
Source
+rd
+rdDouble-precision IEEE 754 mathematical operations.
A container core for operations related to double-precision binary floats.
+rd has four rounding modes: round to nearest (%n), round up (%u), round down (%d), and round to zero (%z). The default rounding mode is %z. If you need a different rounding mode, you'd do something like =/ rd-n ~(. rd [%n rtol]) and then call the arms of your modified version instead.
+rd supports a relative tolerance for precision of operations, which is set by the rtol parameter. The default value is _.~1e-10, but you can change it by passing a different value in the rd door.
Source
+tau
+tauThe value (OEIS A019692), radian angle measure of a full turn.
Produces
The value of tau or 2 pi , radian angle measure of a full turn, represented as a single-precision floating-point atom.
Examples
Source
+pi
+piThe value pi (OEIS A000796), radian angle measure of a half turn.
Produces
The value of pi , radian angle measure of a half turn, represented as a single-precision floating-point atom.
Examples
Source
+e
+eReturn the value e (Euler's constant) (OEIS A001113).
Produces
The value of e, represented as a double-precision floating-point atom.
Examples
Source
+phi
+phiThe value phi (golden ratio) (OEIS A001622).
Produces
The value of phi, represented as a double-precision floating-point atom.
Examples
Source
+sqt2
+sqt2The value sqrt(2) (OEIS A002193).
Produces
The value of sqrt(2), represented as a double-precision floating-point atom.
Examples
Source
+invsqt2
+invsqt2The value 1/sqrt(2) (OEIS A010503).
Produces
The value of 1/sqrt(2), represented as a double-precision floating-point atom.
Examples
Source
+log2
+log2The value log(2) (OEIS A002162).
Produces
The value of log(2), represented as a double-precision floating-point atom.
Examples
Source
+invlog2
+invlog2The value 1/log(2).
Produces
The value of 1/log(2), represented as a double-precision floating-point atom.
Examples
Source
+log10
+log10The value log(10) (OEIS A002392).
Produces
The value of log(10), represented as a double-precision floating-point atom.
Examples
Source
+huge
+hugeThe value of the largest representable number.
Produces
The value of the largest representable number, represented as a double-precision floating-point atom.
Examples
Source
+tiny
+tinyThe value of the smallest representable normal number.
Produces
The value of the smallest representable normal number, represented as a double-precision floating-point atom.
Examples
Source
+sea
+seaFloating-point atom representation.
Accepts
A floating-point atom (@rd).
Produces
The $fn representation of the floating-point atom.
Examples
Source
+bit
+bitFloating-point atom representation.
Accepts
The $fn representation of a floating-point atom.
Produces
A floating-point atom (@rd).
Examples
Source
+sun
+sunFloating-point atom of an unsigned integer atom.
Accepts
An unsigned integer atom (@ud).
Produces
A floating-point atom (@rd).
Examples
Source
+san
+sanFloating-point atom of a signed integer atom.
Accepts
A signed integer atom (@sd).
Produces
A floating-point atom (@rd).
Examples
Source
+toi
+toiThe unitized signed integer atom of a rounded floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A unitized signed integer atom (@sd).
Examples
Source
+drg
+drgThe decimal form of a floating-point atom using the Dragon4 algorithm.
Accepts
A floating-point atom (@rd).
Produces
A decimal form (+dn).
Examples
Source
+grd
+grdThe floating-point atom of a decimal form. Inverse of +drg.
Accepts
A decimal form (+dn).
Produces
A floating-point atom (@rd).
Examples
Source
+lth
+lthThe comparison of two floating-point atoms, less than.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+lte
+lteThe comparison of two floating-point atoms, less than or equal to.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+leq
+leqThe comparison of two floating-point atoms, less than or equal to. Alias for +lte.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+equ
+equThe comparison of two floating-point atoms, equal to.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+gth
+gthThe comparison of two floating-point atoms, greater than.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+gte
+gteThe comparison of two floating-point atoms, greater than or equal to.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+geq
+geqThe comparison of two floating-point atoms, greater than or equal to. Alias for +gte.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+neq
+neqThe comparison of two floating-point atoms, not equal to.
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+is-close
+is-closeThe comparison of two floating-point atoms, within a relative tolerance (provided by the +rd door).
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+all-close
+all-closeThe comparison of a floating-point atom to a list of floating- point atoms, within a relative tolerance (provided by the +rd door).
Accepts
A pair of floating-point atoms (@rd).
Produces
A $flag.
Examples
Source
+is-int
+is-intReturns whether a floating-point value is an integer (no fractional part).
Accepts
A floating-point atom (@rd).
Produces
A $flag.
Examples
Source
+add
+addThe sum of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+sub
+subThe difference of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+mul
+mulThe product of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+div
+divThe quotient of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+fma
+fmaThe fused multiply-add of three floating-point atoms.
Accepts
A triplet of floating-point atoms (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+sig
+sigThe sign of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A $flag.
Examples
Source
+sgn
+sgnThe sign of a floating-point atom. Alias for +sig.
Accepts
A floating-point atom (@rd).
Produces
A $flag.
Examples
Source
+neg
+negThe negation of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+factorial
+factorialThe factorial of a floating-point atom. Assumes integer input.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+abs
+absThe absolute value of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+exp
+expThe exponential of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+sin
+sinThe sine of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+cos
+cosThe cosine of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+tan
+tanThe tangent of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+asin
+asinThe inverse sine of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+acos
+acosThe inverse cosine of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+atan
+atanThe inverse tangent of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+atan2
+atan2The inverse tangent of a floating-point coordinate.
Accepts
A pair of floating-point atoms (@rd), representing the y and x coordinates.
Produces
A floating-point atom (@rd).
Examples
Source
+pow-n
+pow-nReturns the power of a floating-point atom to an integer exponent.
Accepts
A pair of floating-point atoms (@rd), where the first is the base and the second is the exponent.
Produces
A floating-point atom (@rd).
Examples
Source
+log
+logThe natural logarithm of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+log-10
+log-10The base-10 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+log-2
+log-2The base-2 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+pow
+powThe power of a floating-point atom to a floating-point exponent.
Accepts
A pair of floating-point atoms (@rd), where the first is the base and the second is the exponent.
Produces
A floating-point atom (@rd).
Examples
Source
+sqrt
+sqrtThe square root of a floating-point atom. Alias for +sqt.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+sqt
+sqtThe square root of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+cbrt
+cbrtThe cube root of a floating-point atom. Alias for +cbt.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+cbt
+cbtThe cube root of a floating-point atom.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+arg
+argThe argument of a floating-point atom (real argument = absolute value).
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+round
+roundThe rounding of a floating-point atom to a given number of decimal places.
Accepts
A pair of floating-point atoms (@rd and @ud), where the first is the value to round and the second is the number of decimal places.
Produces
A floating-point atom (@rd).
Examples
Source
+round-places
+round-placesRounds a floating-point atom to a specified number of decimal places.
Accepts
A pair of floating-point atoms (@rd and @ud), where the first is the value to round and the second is the number of decimal places.
Produces
A floating-point atom (@rd).
Examples
Discussion
This is exceptionally sensitive to off-by-one floating-point rounding error.
Source
+round-bankers
+round-bankersThe floating-point atom rounded to the nearest integer, with ties rounded to the nearest even integer.
Accepts
A floating-point atom (@rd).
Produces
A floating-point atom (@rd).
Examples
Source
+rh
+rhHalf-precision IEEE 754 floating-point arithmetic.
A container core for operations related to half-precision binary floats.
+rh has four rounding modes: round to nearest (%n), round up (%u), round down (%d), and round to zero (%z). The default rounding mode is %z. If you need a different rounding mode, you'd do something like =/ rh-n ~(. rh [%n rtol]) and then call the arms of your modified version instead.
+rh supports a relative tolerance for precision of operations, which is set by the rtol parameter. The default value is _.~~1e-2, but you can change it by passing a different value in the rh door.
Source
+tau
+tauThe value (OEIS A019692), radian angle measure of a full turn.
Produces
The value of tau or 2 pi , radian angle measure of a full turn, represented as a single-precision floating-point atom.
Examples
Source
+pi
+piThe value pi (OEIS A000796), radian angle measure of a half turn.
Produces
The value of pi , radian angle measure of a half turn, represented as a single-precision floating-point atom.
Examples
Source
+e
+eThe value e (Euler's constant) (OEIS A001113).
Produces
The value of e, represented as a half-precision floating-point atom.
Examples
Source
+phi
+phiThe value phi (golden ratio) (OEIS A001622).
Produces
The value of phi, represented as a half-precision floating-point atom.
Examples
Source
+sqt2
+sqt2The value sqrt(2) (OEIS A002193).
Produces
The value of sqrt(2), represented as a half-precision floating-point atom.
Examples
Source
+invsqt2
+invsqt2The value 1/sqrt(2) (OEIS A010503).
Produces
The value of 1/sqrt(2), represented as a half-precision floating-point atom.
Examples
Source
+log2
+log2The value log(2) (OEIS A002162).
Produces
The value of log(2), represented as a half-precision floating-point atom.
Examples
Source
+invlog2
+invlog2The value 1/log(2).
Produces
The value of 1/log(2), represented as a half-precision floating-point atom.
Examples
Source
+log10
+log10The value log(10) (OEIS A002392).
Produces
The value of log(10), represented as a half-precision floating-point atom.
Examples
Source
+huge
+hugeThe value of the largest representable number.
Produces
The value of the largest representable number, represented as a half-precision floating-point atom.
Examples
Source
+tiny
+tinyThe value of the smallest representable normal number.
Produces
The value of the smallest representable normal number, represented as a half-precision floating-point atom.
Examples
Source
+sea
+seaFloating-point atom representation.
Accepts
A floating-point atom (@rh).
Produces
A $fn representation of the floating-point atom.
Examples
Source
+bit
+bitThe floating-point atom representation of a $fn.
Accepts
A $fn representation of a floating-point atom.
Produces
A floating-point atom (@rh).
Examples
Source
+sun
+sunFloating-point atom of an unsigned integer.
Accepts
An unsigned integer atom (@ud).
Produces
A floating-point atom (@rh).
Examples
Source
+san
+sanThe floating-point atom of a signed integer.
Accepts
A signed integer atom (@sd).
Produces
A floating-point atom (@rh).
Examples
Source
+toi
+toiThe unitized signed integer atom of a rounded floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A unitized signed integer atom (@sd).
Examples
Source
+drg
+drgThe decimal form of a floating-point atom using the Dragon4 algorithm.
Accepts
A floating-point atom (@rh).
Produces
A decimal form (+dn).
Examples
Source
+grd
+grdThe floating-point atom of a decimal form. Inverse of +drg.
Accepts
A decimal form (+dn).
Produces
A floating-point atom (@rh).
Examples
Source
+lth
+lthThe comparison of two floating-point atoms, less than.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+lte
+lteThe comparison of two floating-point atoms, less than or equal to.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+leq
+leqThe comparison of two floating-point atoms, less than or equal to. Alias for +lte.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+equ
+equThe comparison of two floating-point atoms, equal to.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+gth
+gthThe comparison of two floating-point atoms, greater than.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+gte
+gteThe comparison of two floating-point atoms, greater than or equal to.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+geq
+geqThe comparison of two floating-point atoms, greater than or equal to. Alias for +gte.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+neq
+neqThe comparison of two floating-point atoms, not equal to.
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+is-close
+is-closeThe comparison of two floating-point atoms, within a relative tolerance (provided by the +rh door).
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+all-close
+all-closeThe comparison of a floating-point atom to a list of floating-point atoms, within a relative tolerance (provided by the +rh door).
Accepts
A pair of floating-point atoms (@rh).
Produces
A $flag.
Examples
Source
+is-int
+is-intReturns whether a floating-point value is an integer (no fractional part).
Accepts
A floating-point atom (@rh).
Produces
A $flag.
Examples
Source
+add
+addThe sum of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+sub
+subThe difference of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+mul
+mulThe product of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+div
+divThe quotient of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+fma
+fmaThe fused multiply-add of three floating-point atoms.
Accepts
A triplet of floating-point atoms (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+sig
+sigThe sign of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A $flag.
Examples
Source
+sgn
+sgnThe sign of a floating-point atom. Alias for +sig.
Accepts
A floating-point atom (@rh).
Produces
A $flag.
Examples
Source
+neg
+negThe negation of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+factorial
+factorialThe factorial of a floating-point atom. Assumes integer input.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+abs
+absThe absolute value of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+exp
+expThe exponential of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+sin
+sinThe sine of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+cos
+cosThe cosine of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+tan
+tanThe tangent of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+asin
+asinThe inverse sine of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+acos
+acosThe inverse cosine of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+atan
+atanThe inverse tangent of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+atan2
+atan2The inverse tangent of a floating-point coordinate.
Accepts
A pair of floating-point atoms (@rh), representing the y and x coordinates.
Produces
A floating-point atom (@rh).
Examples
Source
+pow-n
+pow-nReturns the power of a floating-point atom to an integer exponent.
Accepts
A pair of floating-point atoms (@rh), where the first is the base and the second is the exponent.
Produces
A floating-point atom (@rh).
Examples
Source
+log
+logThe natural logarithm of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+log-10
+log-10The base-10 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+log-2
+log-2The base-2 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+pow
+powThe power of a floating-point atom to a floating-point exponent.
Accepts
A pair of floating-point atoms (@rh), where the first is the base and the second is the exponent.
Produces
A floating-point atom (@rh).
Examples
Source
+sqrt
+sqrtThe square root of a floating-point atom. Alias for +sqt.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+sqt
+sqtThe square root of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+cbrt
+cbrtThe cube root of a floating-point atom. Alias for +cbt.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+cbt
+cbtThe cube root of a floating-point atom.
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+arg
+argThe argument of a floating-point atom (real argument = absolute value).
Accepts
A floating-point atom (@rh).
Produces
A floating-point atom (@rh).
Examples
Source
+rq
+rqQuadruple-precision IEEE 754 floating-point arithmetic.
A container core for operations related to quadruple-precision binary floats.
+rq has four rounding modes: round to nearest (%n), round up (%u), round down (%d), and round to zero (%z). The default rounding mode is %z. If you need a different rounding mode, you'd do something like =/ rq-n ~(. rq [%n rtol]) and then call the arms of your modified version instead.
+rq supports a relative tolerance for precision of operations, which is set by the rtol parameter. The default value is _.~~~1e-20, but you can change it by passing a different value in the rq door.
Source
+tau
+tauThe value (OEIS A019692), radian angle measure of a full turn.
Produces
The value of tau or 2 pi , radian angle measure of a full turn, represented as a single-precision floating-point atom.
Examples
Source
+pi
+piThe value pi (OEIS A000796), radian angle measure of a half turn.
Produces
The value of pi , radian angle measure of a half turn, represented as a single-precision floating-point atom.
Examples
Source
+e
+eThe value e (Euler's constant) (OEIS A001113).
Produces
The value of e, represented as a quad-precision floating-point atom.
Examples
Source
+phi
+phiThe value phi (golden ratio) (OEIS A001622).
Produces
The value of phi, represented as a quad-precision floating-point atom.
Examples
Source
+sqt2
+sqt2The value sqrt(2) (OEIS A002193).
Produces
The value of sqrt(2), represented as a quad-precision floating-point atom.
Examples
Source
+invsqt2
+invsqt2The value 1/sqrt(2) (OEIS A010503).
Produces
The value of 1/sqrt(2), represented as a quad-precision floating-point atom.
Examples
Source
+log2
+log2The value log(2) (OEIS A002162).
Produces
The value of log(2), represented as a quad-precision floating-point atom.
Examples
Source
+invlog2
+invlog2The value 1/log(2).
Produces
The value of 1/log(2), represented as a quad-precision floating-point atom.
Examples
Source
+log10
+log10The value log(10) (OEIS A002392).
Produces
The value of log(10), represented as a quad-precision floating-point atom.
Examples
Source
+huge
+hugeThe value of the largest representable number.
Produces
The value of the largest representable number, represented as a quad-precision floating-point atom.
Examples
Source
+tiny
+tinyThe value of the smallest representable normal number.
Produces
The value of the smallest representable normal number, represented as a quad-precision floating-point atom.
Examples
Source
+sea
+seaFloating-point atom representation.
Accepts
A floating-point atom (@rq).
Produces
The $fn representation of the floating-point atom.
Source
+bit
+bitFloating-point atom representation.
Accepts
The $fn representation of a floating-point atom.
Produces
A floating-point atom (@rq).
Source
+sun
+sunFloating-point atom of an unsigned integer atom.
Accepts
An unsigned integer atom (@ud).
Produces
A floating-point atom (@rq).
Source
+san
+sanFloating-point atom of a signed integer atom.
Accepts
A signed integer atom (@sd).
Produces
A floating-point atom (@rq).
Source
+toi
+toiThe unitized signed integer atom of a rounded floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A unitized signed integer atom (@sd).
Source
+drg
+drgThe decimal form of a floating-point atom using the Dragon4 algorithm.
Accepts
A floating-point atom (@rq).
Produces
A decimal form (+dn).
Source
+grd
+grdThe floating-point atom of a decimal form. Inverse of +drg.
Accepts
A decimal form (+dn).
Produces
A floating-point atom (@rq).
Source
+lth
+lthThe comparison of two floating-point atoms, less than.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+lte
+lteThe comparison of two floating-point atoms, less than or equal to.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+leq
+leqThe comparison of two floating-point atoms, less than or equal to. Alias for +lte.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+equ
+equThe comparison of two floating-point atoms, equal to.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+gth
+gthThe comparison of two floating-point atoms, greater than.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+gte
+gteThe comparison of two floating-point atoms, greater than or equal to.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+geq
+geqThe comparison of two floating-point atoms, greater than or equal to. Alias for +gte.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+neq
+neqThe comparison of two floating-point atoms, not equal to.
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+is-close
+is-closeThe comparison of two floating-point atoms, within a relative tolerance (provided by the +rq door).
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+all-close
+all-closeThe comparison of a floating-point atom to a list of floating- point atoms, within a relative tolerance (provided by the +rq door).
Accepts
A pair of floating-point atoms (@rq).
Produces
A $flag.
Source
+is-int
+is-intReturns whether a floating-point value is an integer (no fractional part).
Accepts
A floating-point atom (@rq).
Produces
A $flag.
Source
+add
+addThe sum of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rq).
Produces
A floating-point atom (@rq).
Source
+sub
+subThe difference of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rq).
Produces
A floating-point atom (@rq).
Source
+mul
+mulThe product of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rq).
Produces
A floating-point atom (@rq).
Source
+div
+divThe quotient of two floating-point atoms.
Accepts
A pair of floating-point atoms (@rq).
Produces
A floating-point atom (@rq).
Source
+fma
+fmaThe fused multiply-add of three floating-point atoms.
Accepts
A triplet of floating-point atoms (@rq).
Produces
A floating-point atom (@rq).
Source
+sig
+sigThe sign of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A $flag.
Source
+sgn
+sgnThe sign of a floating-point atom. Alias for +sig.
Accepts
A floating-point atom (@rq).
Produces
A $flag.
Source
+neg
+negThe negation of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Source
+factorial
+factorialThe factorial of a floating-point atom. Assumes integer input.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Source
+abs
+absThe absolute value of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Source
+exp
+expThe exponential of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+sin
+sinThe sine of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+cos
+cosThe cosine of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+tan
+tanThe tangent of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+asin
+asinThe inverse sine of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+acos
+acosThe inverse cosine of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+atan
+atanThe inverse tangent of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+atan2
+atan2The inverse tangent of a floating-point coordinate.
Accepts
A pair of floating-point atoms (@rq), representing the y and x coordinates.
Produces
A floating-point atom (@rq).
Examples
Source
+pow-n
+pow-nThe power of a floating-point atom to an integer exponent.
Accepts
A pair of floating-point atoms (@rq), representing the base and the exponent.
Produces
A floating-point atom (@rq).
Examples
Source
+log
+logThe natural logarithm of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+log-10
+log-10The base-10 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Source
+log-2
+log-2The base-2 logarithm of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Source
+pow
+powThe power of a floating-point atom to a floating-point exponent.
Accepts
A pair of floating-point atoms (@rq), representing the base and the exponent.
Produces
A floating-point atom (@rq).
Examples
Source
+sqrt
+sqrtThe square root of a floating-point atom. Alias for +sqt.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+sqt
+sqtThe square root of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+cbrt
+cbrtThe cube root of a floating-point atom. Alias for +cbt.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+cbt
+cbtThe cube root of a floating-point atom.
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
Source
+arg
+argThe argument of a floating-point atom (real argument = absolute value).
Accepts
A floating-point atom (@rq).
Produces
A floating-point atom (@rq).
Examples
+reference
+referenceA core of reference values in high precision as hard-coded string constants for reference and testing purposes.
+tau
+tauThe value (OEIS A019692), radian angle measure of a full turn.
Source
+pi
+piThe value (OEIS A000796), radian angle measure of a half turn.
Source
+e
+eThe value (Euler's number, OEIS A001113).
Source
+phi
+phiThe value (the golden ratio, OEIS A001622).
Source
+sqt2
+sqt2The square root of 2 (OEIS A002193).
Source
+invsqt2
+invsqt2The inverse square root of 2 (OEIS A010503).
Source
+log2
+log2The natural logarithm of 2 (approximately 0.693147, OEIS A002392).
Source
+log10
+log10The natural logarithm of 10 (approximately 2.302585, OEIS A002392).
Source
Last updated