Numbers

The Numbers module provides a number of mathematical functions to that complement the built-in Math library.

Range

A class that encompasses a range between two numbers.

Version

Represents an immutable MAJOR.MINOR.PATCH version following semantic versioning rules.

configure()

Configures the default tolerance to use for number comparison.

closest()

Finds the number closest to another.

compare()

Accurately compares two integral or floating point numbers with the given tolerance and returns a value indicating whether they are “equal”.

exponent()

Finds the exponent used to raise a base to a certain power.

from()

Attempts to convert an arbitrary object into a number.

gcd()

Returns the greatest common divisor of two or more integers.

isEven()

Checks if a number is an even number.

isFloat()

Checks if a number is a floating point number.

isOdd()

Checks if a number is an odd number.

isSafeFloat()

Checks if a number is a “safe” floating point number, that is whether it is unlikely to suffer from floating point inaccuracies.

isUnsafeFloat()

Checks if a number is an “unsafe” floating point number, that is whether it is likely to suffer from floating point inaccuracies.

lcm()

Returns the least common multiple of two or more integers.

mean()

Gets the average of a sequence of numbers.

median()

Gets the median of a sequence of numbers.

range()

Creates a new Range from the given numbers.

roman()

Converts a positive non-zero integer to a roman numeral.

sum()

Gets the sum of a sequence of numbers.