keen/number
SourceThis is a standard module
and does not need to be explicitly imported.
See also 'keen/math/math'
nat8 builtin8-bit natural number. An unsigned integer in the range 0 through 255.
nat16 builtin16-bit natural number. An unsigned integer in the range 0 through 65_535.
nat32 builtin32-bit natural number. An unsigned integer in the range 0 through 4_294_967_295 (4 billion).
nat64 builtin64-bit natural number. An unsigned integer in the range 0 through 18_446_744_073_709_551_615 (18 quintillion).
int8 builtin8-bit signed integer. In the range -128 through 127.
int16 builtin16-bit signed integer. In the range -32_768 through 32_767.
int32 builtin32-bit signed integer. In the range -2_147_483_648 through 2_147_483_647 (-2 billion through 2 billion).
int64 builtin64-bit signed integer, In the range 9_223_372_036_854_775_808 through 9_223_372_036_854_775_807 (-9 quintillion through 9 quintillion).
float32 builtin32-bit IEEE floating point number.
float64 builtin64-bit IEEE floating point number.
== bool(a float32, b float32)This treats all
nan values as equal, since safe code can't distinguish them. However, -0 is not equal to 0.float-equal bool(a float32, b float32)IEEE equality: Treats '-0' and '0' as equal and
nan as not equal to itself.float-equal bool(a float64, b float64)IEEE equality: Treats '-0' and '0' as equal and
nan as not equal to itself.float-less bool(a float32, b float32)IEEE less-than: Treats '-0' and '0' as equal and always compares false when some operand is
nan.integral unionUsed to store values for exceptions
unary-out-of-range recorddivide-by-0 record (has private fields)+ nat8(a nat8, b nat8)Throws if the result would overflow.
"Overflow" means: be greater than the maximum possible value.
modulo-of-negative record (has private fields)+ int8(a int8, b int8)Throws unary-out-of-range if the result would overflow.
"Overflow" means: Be less than the least possible value or greater than the greatest possible value.
/ int8(a int8, b int8)Flooring division. Throws if
b == 0. Throws if the result would overflow, which only happens if a is min-value and b is -1.power-of-negative-number record (has private fields)nan float32() unsafeNot-a-Number value. 'unsafe' because Keen generally throws exceptions instead of returning NaN.
to float32(a nat64)Conversions between integral types throw on overflow or underflow. Conversions involving floats (in either direction) are approximate and never throw.