Number type (joe)


The Number type is a static type that collects together a number of useful constants and numeric methods. Most of the methods gathered here are delegated directly to Java's java.lang.Math class; numeric details are to be found there.

Constants

Static Methods

Initializer

Constants


Number.E


The double-precision value that is closer than any other to e, the base of the natural logarithms.

Number.MAX_INT


The maximum value of a Java integer.

Number.MAX_VALUE


The maximum value of a Java double.

Number.MIN_INT


The minimum (most negative) value of a Java integer.

Number.MIN_VALUE


The minimum (most negative) value of a Java double.

Number.NAN


The double-precision value signifying "not a number".

Number.NEGATIVE_INFINITY


The double-precision value signifying negative infinity.

Number.PI


The double-precision value that is closer than any other to 𝛑, the ratio of the circumference of a circle to its diameter.

Number.POSITIVE_INFINITY


The double-precision value signifying positive infinity.

Number.TAU


The double-precision value that is closer than any other to 𝛕, the ratio of the circumference of a circle to its radius.

Static Methods


Number.abs()


Number.abs(num) → Number

Returns the absolute value of the given number.

Number.acos()


Number.acos(num) → Number

Returns the arc cosine of the number

Number.asin()


Number.asin(num) → Number

Returns the arc sine of the number.

Number.atan()


Number.atan(num) → Number

Returns the arc tangent of the number.

Number.atan2()


Number.atan2(x, y) → Number

Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).

Number.ceil()


Number.ceil(num) → Number

Returns the smallest integer number that is greater than or equal to num.

Number.clamp()


Number.clamp(num, min, max) → Number

Clamps num to fit between min and max.

Number.cos()


Number.cos(a) → Number

Returns the cosine of angle a.

Number.exp()


Number.exp(num) → Number

Returns Number.E raised the num power.

Number.floor()


Number.floor(num) → Number

Returns the largest integer number that is less than or equal to num.

Number.hypot()


Number.hypot(x, y) → Number

Returns the length of the hypotenuse of a right triangle with legs of length x and y.

Number.log()


Number.log(num) → Number

Returns the natural logarithm of the number.

Number.log10()


Number.log10(num) → Number

Returns the base-10 logarithm of the number.

Number.max()


Number.max(num...) → Number

Given one or more numbers, returns the maximum value. The numbers may be passed as individual arguments or as a single List.

Number.min()


Number.min(num...) → Number

Given one or more numbers, returns the minimum value. The numbers may be passed as individual arguments or as a single List.

Number.mod()


Number.mod(a, b) → Number

Returns the integer modulus a % b as computed in Java. Both terms are converted to integers.

Number.pow()


Number.pow(a, b) → Number

Returns a raised to the b power.

Number.random()


Number.random() → Number

Returns a random number in the range 0.0 <= x < 1.0.

Number.round()


Number.round(num) → Number

Returns the closest integer number to num, rounding ties toward positive infinity.

Number.sin()


Number.sin(a) → Number

Returns the sine of the angle.

Number.sqrt()


Number.sqrt(num) → Number

Returns the square root of the number.

Number.tan()


Number.tan(a) → Number

Returns the tangent of the angle.

Number.toDegrees()


Number.toDegrees(radians) → Number

Converts an angle in radians to an angle in degrees.

Number.toRadians()


Number.toRadians(degrees) → Number

Converts an angle in degrees to an angle in radians.

Number Initializer


Number(string) → Number

Converts a numeric string to a number. Supports Joe's numeric literal syntax, including hexadecimals.