Returns a new Integer with the same value. This is useful when you want an explicit copy before passing the value around or transforming it.
@eryx/number Module
This library provides four numeric domains backed by GMP and MPFR:
number.integer: arbitrary-precision exact integersnumber.rational: arbitrary-precision exact fractionsnumber.float: arbitrary-precision floating-point valuesnumber.number: an ergonomic dynamic wrapper that switches between integer and float
Use Integer when exact whole-number arithmetic matters, such as counters, combinatorics,
bitwise work, cryptography, IDs, or number theory. Use Rational when you need exact
fractions and want to avoid the rounding behavior of floating point. Use Float when you
want explicit control over precision and floating-point rounding. Use Number when you want
the most ergonomic interface and are happy with Python-like promotion between integer and float.
Number is intentionally only a union of Integer and Float. It does not automatically enter
the Rational domain, because exact fractions can grow in size quickly and that cost is easy to
miss if promotion happens implicitly.
There are a few important behavior rules to keep in mind:
Number / Numberpromotes to the floating-point domain.- Integer-like whole-result helpers such as
Number:floor(),:ceil(),:trunc(),:round(), and//promote back to integer-kindNumber. Integer,Float, andNumbercan all interoperate with plain Luaunumbervalues in many common arithmetic paths.Numberuses the same default floating-point precision asnumber.float. If a Number operation needs to create a float and you do not pass an explicit precision, it usesnumber.float.defaultPrecision().
Common patterns:
local number = require("@eryx/number")
local integer = number.integer
local float = number.float
local dynamic = number.number
local huge = integer.fromString("123456789012345678901234567890")
local exact = huge * 9
local ratio = number.rational.new(1, 3)
local approx = ratio:toFloat(128)
local mixed = dynamic.fromInteger(10) / 4
print(mixed:kind()) -- "float"
print(mixed) -- 2.5
local whole = mixed:floor()
print(whole:kind()) -- "integer"
print(whole) -- 2
If you already know which numeric domain you want, prefer the explicit module for clarity.
Reach for number.number when you want convenience first and explicit domain control second.
Summary
Classes
Functions
API Reference
Classes
Integer
Properties
Integer:abs
Returns the absolute value of the integer. Negative inputs become positive; zero and positive values are unchanged.
Returns
A non-negative Integer with the same magnitude as self.
Integer:sign
Returns the sign of the integer.
The result is -1 for negative values, 0 for zero, and 1 for positive values.
Returns
The sign of self.
Integer:cmp
Compares this integer with another integer-like value. This is the explicit comparison method behind the ordering operators.
Parameters
Returns
A negative number if self < other, zero if self == other, or a positive number if self > other.
Integer:isZero
Checks whether the integer is exactly zero. This is a convenience predicate for branchy arithmetic code.
Returns
true if self is zero, otherwise false.
Integer:isOne
Checks whether the integer is exactly one. This is often handy in algorithms with multiplicative identities.
Returns
true if self is one, otherwise false.
Integer:isEven
Checks whether the integer is even. Evenness is determined by the low bit, so this works efficiently even for very large values.
Returns
true if self is evenly divisible by two, otherwise false.
Integer:isOdd
Checks whether the integer is odd.
This is the complement of isEven().
Returns
true if self is not evenly divisible by two, otherwise false.
Integer:divTrunc
Divides two integers using truncating division. The quotient is rounded toward zero.
Parameters
Returns
The truncated quotient.
Integer:divFloor
Divides two integers using floor division. The quotient is rounded toward negative infinity.
Parameters
Returns
The floored quotient.
Integer:divCeil
Divides two integers using ceiling division. The quotient is rounded toward positive infinity.
Parameters
Returns
The ceiled quotient.
Integer:divmod
Divides two integers and returns both the quotient and remainder.
The quotient rounding rule is controlled by mode, and the remainder follows that choice.
Parameters
The rounding mode to use: "trunc", "floor", or "ceil".
Returns
Integer:gcd
Computes the greatest common divisor of two integers. The result is always non-negative.
Parameters
Returns
The greatest common divisor of self and other.
Integer:lcm
Computes the least common multiple of two integers. This is useful for normalising periods, denominators, or modular steps.
Parameters
Returns
The least common multiple of self and other.
Integer:extendedGcd
Computes the extended greatest common divisor.
The returned coefficients satisfy g = self * x + other * y.
Parameters
Returns
Integer:pow
Raises the integer to a non-negative integral power. Use this when you want exact integer exponentiation without leaving the integer domain.
Parameters
Returns
self raised to exponent.
Integer:modPow
Computes modular exponentiation.
This evaluates self^exponent mod modulus efficiently, even for very large values.
Parameters
Returns
The modular power result.
Integer:modInverse
Computes the modular multiplicative inverse.
If no inverse exists because the values are not coprime, this returns nil.
Parameters
Returns
The modular inverse of self modulo modulus, or nil if none exists.
Integer:isProbablePrime
Performs a probabilistic primality test. More repetitions increase confidence for composite detection.
Parameters
The number of primality test rounds to run.
Returns
true if the value is probably prime, otherwise false.
Integer:nextPrime
Finds the next probable prime greater than this integer. This is useful for search-based number theory and cryptographic helpers.
Returns
The next probable prime after self.
Integer:bitLength
Returns the number of significant bits required to represent the integer.
Zero has a bit length of 0.
Returns
The bit length of self.
Integer:popcount
Counts the number of set bits in the integer. This is also known as the population count or Hamming weight.
Returns
The number of 1 bits in self.
Integer:testBit
Checks whether a specific bit is set.
Bit positions are zero-based, where bit 0 is the least significant bit.
Parameters
The zero-based bit index to inspect.
Returns
true if the bit is set, otherwise false.
Integer:setBit
Returns a copy of the integer with the given bit set to 1.
Bit positions are zero-based.
Parameters
The zero-based bit index to set.
Returns
A new Integer with the selected bit set.
Integer:clearBit
Returns a copy of the integer with the given bit cleared to 0.
Bit positions are zero-based.
Parameters
The zero-based bit index to clear.
Returns
A new Integer with the selected bit cleared.
Integer:flipBit
Returns a copy of the integer with the given bit toggled. Bit positions are zero-based.
Parameters
The zero-based bit index to flip.
Returns
A new Integer with the selected bit inverted.
Integer:band
Computes the bitwise AND of two integers. This uses two's-complement style infinite-width semantics, matching GMP's integer bit operations.
Parameters
Returns
The bitwise AND of self and other.
Integer:bor
Computes the bitwise OR of two integers. This uses two's-complement style infinite-width semantics.
Parameters
Returns
The bitwise OR of self and other.
Integer:bxor
Computes the bitwise XOR of two integers. This uses two's-complement style infinite-width semantics.
Parameters
Returns
The bitwise XOR of self and other.
Integer:bnot
Computes the bitwise complement of the integer. This uses two's-complement style infinite-width semantics.
Returns
The bitwise complement of self.
Integer:shl
Shifts the integer left by the given number of bits. Negative shift counts reverse direction and behave like a right shift.
Parameters
The number of bit positions to shift.
Returns
The shifted Integer.
Integer:shr
Shifts the integer right by the given number of bits. Negative shift counts reverse direction and behave like a left shift.
Parameters
The number of bit positions to shift.
Returns
The shifted Integer.
Integer:toString
Formats the integer as a string in the chosen base.
Base 10 is the default, and other bases are useful for binary, hexadecimal, and compact serialisation.
Parameters
The radix to use when formatting the integer.
Returns
A string representation of self.
Integer:toNumber
Converts the integer to a Luau number. This conversion is intended for ergonomic interop with ordinary numeric code.
Returns
The value of self as a Luau number.
Integer:toRational
Converts the integer into an exact Rational with denominator 1.
This is useful when you want to move from integer arithmetic into rational arithmetic without losing precision.
Returns
A Rational equal to self / 1.
Integer:toFloat
Promotes the integer into the floating-point domain. This is useful when you want MPFR-backed operations starting from an exact integer value.
Parameters
The precision to use for the resulting Float, in bits.
Returns
A Float equal to self.
Integer:toI64
Converts the integer to a signed 64-bit integer. Use this when you explicitly need a fixed-width signed representation.
Returns
The value of self as a signed 64-bit integer.
Integer:toU64
Converts the integer to an unsigned 64-bit integer. Use this when you explicitly need a fixed-width unsigned representation.
Returns
The value of self as an unsigned 64-bit integer.
Integer:fitsNumber
Checks whether the integer can be represented as a Luau number. This is useful before crossing back into APIs that expect ordinary numbers.
Returns
true if self fits within the supported Luau number representation, otherwise false.
Integer:fitsI64
Checks whether the integer fits in a signed 64-bit integer.
This is a non-throwing guard for toI64().
Returns
true if self fits in signed 64-bit range, otherwise false.
Rational
Properties
Rational:clone
Returns a new Rational with the same value. This is useful when you want an explicit copy before passing the value into other code.
Returns
A new Rational equal to self.
Rational:abs
Returns the absolute value of the rational. Negative inputs become positive; zero and positive values are unchanged.
Returns
A non-negative Rational with the same magnitude as self.
Rational:sign
Returns the sign of the rational.
The result is -1 for negative values, 0 for zero, and 1 for positive values.
Returns
The sign of self.
Rational:cmp
Compares this rational with another rational-like value. This is the explicit comparison method behind the ordering operators.
Parameters
Returns
A negative number if self < other, zero if self == other, or a positive number if self > other.
Rational:inverse
Returns the reciprocal of the rational. This swaps the numerator and denominator, preserving the sign.
Returns
A new Rational equal to 1 / self.
Rational:canonical
Returns the rational in canonical reduced form. This normalises the sign and reduces the numerator and denominator by their greatest common divisor.
Returns
A canonical Rational equivalent to self.
Rational:numerator
Returns the numerator of the rational.
The returned Integer reflects the current exact value of self.
Returns
The numerator of self.
Rational:denominator
Returns the denominator of the rational. In canonical form, this is always positive.
Returns
The denominator of self.
Rational:isZero
Checks whether the rational is exactly zero. This is a convenience predicate for branchy arithmetic code.
Returns
true if self is zero, otherwise false.
Rational:isOne
Checks whether the rational is exactly one. This is often useful in code that works with multiplicative identities.
Returns
true if self is one, otherwise false.
Rational:isInteger
Checks whether the rational is a whole integer value.
This is true when the denominator is 1 after canonicalisation.
Returns
true if self represents an integer, otherwise false.
Rational:floor
Rounds the rational down to the nearest integer. This uses floor semantics, rounding toward negative infinity.
Returns
The floored Integer value.
Rational:ceil
Rounds the rational up to the nearest integer. This uses ceiling semantics, rounding toward positive infinity.
Returns
The ceiled Integer value.
Rational:trunc
Truncates the rational toward zero. This is useful when you want integer projection without floor/ceiling behaviour.
Returns
The truncated Integer value.
Rational:round
Rounds the rational to the nearest integer using the chosen mode. This supports explicit tie-breaking strategies such as nearest-even.
Parameters
The rounding mode to use.
Returns
The rounded Integer value.
Rational:toString
Formats the rational as a string in the chosen base.
Whole-valued rationals may render without a slash; fractional values render as numerator/denominator.
Parameters
The radix to use when formatting the rational.
Returns
A string representation of self.
Rational:toDecimal
Formats the rational as a decimal string. Exact terminating decimals can be emitted directly; otherwise this rounds to the requested number of digits.
Parameters
The number of digits to keep after the decimal point.
The rounding mode to use when rounding is needed.
Returns
A decimal string representation of self.
Rational:toNumber
Converts the rational to a Luau number. This is intended for ergonomic interop with ordinary numeric code when exact rational arithmetic is no longer required.
Returns
The value of self as a Luau number.
Rational:toInteger
Converts the rational to an Integer using the chosen rounding mode. This is useful when you want an explicit and exact integer projection step.
Parameters
The rounding mode to use for the conversion.
Returns
The resulting Integer value.
Rational:toFloat
Converts the rational to a Float using the chosen precision and rounding mode. This is useful when you want to leave the exact rational domain with explicit floating-point control.
Parameters
The precision to use for the resulting Float, in bits.
The rounding mode to use when conversion is inexact.
Returns
The resulting Float approximation of self.
Float
Properties
Float:clone
Returns a new Float with the same numeric value. This is useful when you want an explicit copy, optionally at the same precision as the original.
Returns
A new Float equal to self.
Float:abs
Returns the absolute value of the float. Negative inputs become positive; zero and positive values are unchanged.
Returns
A non-negative Float with the same magnitude as self.
Float:sign
Returns the sign of the float.
The result is -1 for negative values, 0 for zero, and 1 for positive values.
@param self The Float whose sign should be inspected.
Returns
The sign of self.
Float:cmp
Compares this float with another float-like value. This is the explicit comparison method behind the ordering operators.
Parameters
Returns
A negative number if self < other, zero if self == other, or a positive number if self > other.
Float:sqrt
Computes the square root of the float. This stays in the floating-point domain and uses MPFR's rounding behaviour.
Returns
The square root of self.
Float:floor
Rounds the float down to the nearest integer. This uses floor semantics, rounding toward negative infinity.
Returns
The floored Integer value.
Float:ceil
Rounds the float up to the nearest integer. This uses ceiling semantics, rounding toward positive infinity.
Returns
The ceiled Integer value.
Float:trunc
Truncates the float toward zero. This is useful when you want integer projection without floor/ceiling behaviour.
Returns
The truncated Integer value.
Float:round
Rounds the float to an Integer using the chosen rounding mode. This supports explicit tie-breaking strategies such as nearest-even.
Parameters
The rounding mode to use.
Returns
The rounded Integer value.
Float:precision
Returns the precision of the float in bits. This is the stored MPFR precision for the current value.
Returns
The precision of self, in bits.
Float:withPrecision
Returns a copy of the float at a different precision. The value is rounded to the requested precision using the chosen rounding mode.
Parameters
The destination precision in bits.
The rounding mode to use when precision changes.
Returns
A new Float with the requested precision.
Float:isZero
Checks whether the float is exactly zero. This is a convenience predicate for branchy arithmetic code.
Returns
true if self is zero, otherwise false.
Float:isFinite
Checks whether the float is finite.
This distinguishes ordinary numeric values from nan, inf, and -inf.
Returns
true if self is finite, otherwise false.
Float:isNaN
Checks whether the float is nan.
This is useful when you need to distinguish invalid or undefined floating-point results.
Returns
true if self is nan, otherwise false.
Float:isInfinite
Checks whether the float is positive or negative infinity. This is useful when you need to handle overflow-style or unbounded results explicitly.
Returns
true if self is infinite, otherwise false.
Float:toString
Formats the float as a string in the chosen base.
When digits is omitted, the formatter emits a compact representation suitable for display.
Parameters
The radix to use when formatting the float.
The number of digits to emit for the significand.
Returns
A string representation of self.
Float:toNumber
Converts the float to a Luau number. This is intended for ergonomic interop with ordinary numeric code.
Returns
The value of self as a Luau number.
Float:toInteger
Converts the float to an Integer using the chosen rounding mode. This is useful when you want an explicit and exact integer projection step.
Parameters
The rounding mode to use for the conversion.
Returns
The resulting Integer value.
Number
Properties
Number:clone
Returns a new Number with the same value and kind. This is useful when you want an explicit copy before passing it into other code.
Returns
A new Number equal to self.
Number:kind
Reports whether the dynamic number is currently storing an integer or a float. This is useful when you need to branch on the exact runtime representation.
Returns
"integer" if self is backed by an Integer-like value, otherwise "float".
Number:isInteger
Checks whether the dynamic number is currently backed by an integer value. This is a convenience predicate for representation-sensitive code.
Returns
true if self is integer-kind, otherwise false.
Number:isFloat
Checks whether the dynamic number is currently backed by a float value. This is a convenience predicate for representation-sensitive code.
Returns
true if self is float-kind, otherwise false.
Number:integer
Returns the exact Integer view when this Number is integer-kind.
If the value is float-kind, this returns nil instead of rounding implicitly.
Returns
The stored Integer value, or nil if self is float-kind.
Number:float
Returns the exact Float view when this Number is float-kind.
If the value is integer-kind, this returns nil instead of promoting implicitly.
Returns
The stored Float value, or nil if self is integer-kind.
Number:abs
Returns the absolute value of the dynamic number. The result stays in the same numeric domain as the underlying representation.
Returns
A non-negative Number with the same magnitude as self.
Number:sign
Returns the sign of the dynamic number.
The result is -1 for negative values, 0 for zero, and 1 for positive values.
Returns
The sign of self.
Number:cmp
Compares this dynamic number with another dynamic or plain numeric value. This is the explicit comparison method behind the ordering operators.
Parameters
Returns
A negative number if self < other, zero if self == other, or a positive number if self > other.
Number:floor
Rounds the dynamic number down to the nearest integer-valued Number. This uses floor semantics and always returns integer-kind Number storage.
Returns
The floored Number value.
Number:ceil
Rounds the dynamic number up to the nearest integer-valued Number. This uses ceiling semantics and always returns integer-kind Number storage.
Returns
The ceiled Number value.
Number:trunc
Truncates the dynamic number toward zero. This always returns integer-kind Number storage.
Returns
The truncated Number value.
Number:round
Rounds the dynamic number to the nearest integer-valued Number using the chosen mode. This supports explicit tie-breaking strategies such as nearest-even.
Parameters
The rounding mode to use.
Returns
The rounded Number value, stored as integer-kind.
Number:toString
Formats the dynamic number as a string in the chosen base. Integer-kind values use integer formatting, while float-kind values use MPFR formatting rules.
Parameters
The radix to use when formatting the value.
The number of digits to emit for float-kind values.
Returns
A string representation of self.
Number:toNumber
Converts the dynamic number to a Luau number. This is intended for ergonomic interop with ordinary numeric code.
Returns
The value of self as a Luau number.
Number:toInteger
Converts the dynamic number to an Integer using the chosen rounding mode. This is useful when you want an explicit and exact integer projection step.
Parameters
The rounding mode to use for the conversion.
Returns
The resulting Integer value.
Number:toFloat
Converts the dynamic number to a Float, optionally changing its precision. Integer-kind values are promoted into the floating-point domain, and float-kind values may be rounded to a new precision.
Parameters
The destination precision in bits.
The rounding mode to use when rounding is needed.
Returns
The resulting Float value.
integer
number.integer.new
Creates a new Integer from an existing integer-like value. Numbers are treated as whole-number inputs, and strings may be parsed in the given base.
Parameters
The source value to convert into an Integer.
The radix to use when value is a string.
Returns
A new Integer instance.
number.integer.fromString
Parses an Integer from a string. This is the most explicit way to construct very large values without going through a Luau number first.
Parameters
Returns
A new Integer parsed from value.
number.integer.fromNumber
Creates an Integer from a Luau number. This is convenient for ordinary whole-number code paths.
Parameters
The numeric value to convert.
Returns
A new Integer equal to value.
number.integer.fromI64
Creates an Integer from a signed 64-bit integer. Use this when you want to make the fixed-width signed boundary explicit.
Parameters
The signed 64-bit input.
Returns
A new Integer equal to value.
number.integer.fromU64
Creates an Integer from an unsigned 64-bit integer. Use this when you want to make the fixed-width unsigned boundary explicit.
Parameters
The unsigned 64-bit input.
Returns
A new Integer equal to value.
number.integer.zero
Returns the additive identity.
This is equivalent to constructing an Integer with value 0.
Returns
The Integer zero.
number.integer.one
Returns the multiplicative identity.
This is equivalent to constructing an Integer with value 1.
Returns
The Integer one.
number.integer.factorial
Computes the factorial of a non-negative integer. This is exact and can produce very large results.
Parameters
Returns
n! as an Integer.
number.integer.binomial
Computes a binomial coefficient. This is the exact value of "n choose k".
Parameters
Returns
The binomial coefficient C(n, k) as an Integer.
number.integer.isInteger
Checks whether a value is an Integer userdata produced by this module. This is useful for validation and dynamic dispatch.
Parameters
The value to inspect.
Returns
true if value is an Integer, otherwise false.
rational
number.rational.new
Creates a new Rational from rational-like input.
Passing both numerator and denominator constructs the exact quotient of those values.
Parameters
The source value or numerator component.
The optional denominator component.
Returns
A new Rational instance.
number.rational.fromString
Parses a Rational from a string. This accepts integer and fractional forms, including slash-separated values.
Parameters
Returns
A new Rational parsed from value.
number.rational.fromDecimal
Parses a decimal string into an exact Rational. This is useful when you want to preserve the exact value of textual decimal data.
Parameters
The decimal string to parse.
Returns
A new Rational equal to the parsed decimal value.
number.rational.fromFloat
Creates a Rational from a Luau number. This is convenient for interop with ordinary numeric code, though it reflects the input number's floating-point value.
Parameters
The numeric value to convert.
Returns
A new Rational equal to value.
number.rational.fromInteger
Promotes an Integer or whole-number value into the rational domain.
The resulting Rational has denominator 1.
Parameters
Returns
A new Rational equal to value / 1.
number.rational.zero
Returns the additive identity in the rational domain.
This is equivalent to constructing the Rational value 0/1.
Returns
The Rational zero.
number.rational.one
Returns the multiplicative identity in the rational domain.
This is equivalent to constructing the Rational value 1/1.
Returns
The Rational one.
number.rational.isRational
Checks whether a value is a Rational userdata produced by this module. This is useful for validation and dynamic dispatch.
Parameters
The value to inspect.
Returns
true if value is a Rational, otherwise false.
float
number.float.new
Creates a new Float from float-like input. Passing an existing Float preserves its value, and you may optionally override the stored precision.
Parameters
The source value to convert into a Float.
The precision to use for the new Float, in bits.
Returns
A new Float instance.
number.float.fromString
Parses a Float from a string. This is the most explicit way to construct high-precision floating-point values from textual data.
Parameters
The source string to parse.
The radix to use when parsing the string.
The precision to use for the new Float, in bits.
Returns
A new Float parsed from value.
number.float.fromNumber
Creates a Float from a Luau number. This is convenient for interop with ordinary floating-point code.
Parameters
The numeric value to convert.
The precision to use for the new Float, in bits.
Returns
A new Float equal to value.
number.float.fromInteger
Promotes an Integer or whole-number value into the floating-point domain. This is useful when you want MPFR-backed operations on an exact integral input.
Parameters
The precision to use for the new Float, in bits.
Returns
A new Float equal to value.
number.float.fromRational
Converts a Rational into a Float using the chosen rounding mode. This is useful when you want to leave the exact rational domain with explicit precision control.
Parameters
The Rational value to convert.
The precision to use for the new Float, in bits.
The rounding mode to use when conversion is inexact.
Returns
A new Float approximation of value.
number.float.defaultPrecision
Returns the module-wide default MPFR precision. Dynamic Number promotion into floats also follows this shared precision setting.
Returns
The default precision in bits.
number.float.setDefaultPrecision
Sets the module-wide default MPFR precision. This affects newly created floats that do not provide an explicit precision, including dynamic Number promotions.
Parameters
The new default precision in bits.
number.float.zero
Returns the additive identity in the floating-point domain.
This is equivalent to constructing the Float value 0 at the chosen precision.
Parameters
The precision to use for the new Float, in bits.
Returns
The Float zero.
number.float.one
Returns the multiplicative identity in the floating-point domain.
This is equivalent to constructing the Float value 1 at the chosen precision.
Parameters
The precision to use for the new Float, in bits.
Returns
The Float one.
number.float.isFloat
Checks whether a value is a Float userdata produced by this module. This is useful for validation and dynamic dispatch.
Parameters
The value to inspect.
Returns
true if value is a Float, otherwise false.
number
number.number.new
Creates a new dynamic Number from number-like input. Whole values stay in the integer domain when possible, while fractional values use the floating-point domain.
Parameters
The source value to convert into a Number.
The precision to use when a float-backed Number must be created.
Returns
A new Number instance.
number.number.fromString
Parses a dynamic Number from a string. Integer-looking strings stay in the integer domain, while fractional strings create float-backed values.
Parameters
The source string to parse.
The radix to use when parsing the string.
The precision to use when a float-backed Number must be created.
Returns
A new Number parsed from value.
number.number.fromNumber
Creates a dynamic Number from a Luau number. Whole numeric inputs stay integer-kind when possible; fractional inputs become float-kind.
Parameters
The numeric value to convert.
The precision to use when a float-backed Number must be created.
Returns
A new Number equal to value.
number.number.fromInteger
Promotes an Integer or whole-number value into the dynamic Number domain. The resulting value is stored as integer-kind Number.
Parameters
Returns
A new integer-kind Number equal to value.
number.number.fromFloat
Promotes a Float or plain numeric value into the dynamic Number domain. The resulting value is stored as float-kind Number.
Parameters
The precision to use when a new float-backed Number must be created.
Returns
A new float-kind Number equal to value.
number.number.zero
Returns the additive identity in the dynamic Number domain. This is represented as integer-kind zero.
Returns
The Number zero.
number.number.one
Returns the multiplicative identity in the dynamic Number domain. This is represented as integer-kind one.
Returns
The Number one.
number.number.isNumber
Checks whether a value is a Number userdata produced by this module. This is useful for validation and dynamic dispatch.
Parameters
The value to inspect.
Returns
true if value is a Number, otherwise false.