Janet 1.6.0-da93a73 Documentation
(Other Versions: 1.5.1 1.5.0 1.4.0 1.3.1)

Math Module

Index

math/-inf math/abs math/acos math/acosh math/asin math/asinh math/atan math/atan2 math/atanh math/cbrt math/ceil math/cos math/cosh math/e math/exp math/exp2 math/expm1 math/floor math/hypot math/inf math/log math/log10 math/log2 math/pi math/pow math/random math/rng math/rng-buffer math/rng-int math/rng-uniform math/round math/seedrandom math/sin math/sinh math/sqrt math/tan math/tanh math/trunc


math/-inf number
The number representing negative infinity

math/abs cfunction
(math/abs x)

Return the absolute value of x.

math/acos cfunction
(math/acos x)

Returns the arccosine of x.

math/acosh cfunction
(math/acosh x)

Return the hyperbolic arccosine of x.

math/asin cfunction
(math/asin x)

Returns the arcsine of x.

math/asinh cfunction
(math/asinh x)

Return the hyperbolic arcsine of x.

math/atan cfunction
(math/atan x)

Returns the arctangent of x.

math/atan2 cfunction
(math/atan2 y x)

Return the arctangent of y/x. Works even when x is 0.

math/atanh cfunction
(math/atanh x)

Return the hyperbolic arctangent of x.

math/cbrt cfunction
(math/cbrt x)

Returns the cube root of x.

math/ceil cfunction
(math/ceil x)

Returns the smallest integer value number that is not less than x.

math/cos cfunction
(math/cos x)

Returns the cosine of x.

math/cosh cfunction
(math/cosh x)

Return the hyperbolic cosine of x.

math/e number
The base of the natural log.

math/exp cfunction
(math/exp x)

Returns e to the power of x.

math/exp2 cfunction
(math/exp2 x)

Returns 2 to the power of x.

math/expm1 cfunction
(math/expm1 x)

Returns e to the power of x minus 1.

math/floor cfunction
(math/floor x)

Returns the largest integer value number that is not greater than x.

math/hypot cfunction
(math/hypot a b)

Returns the c from the equation c^2 = a^2 + b^2

math/inf number
The number representing positive infinity

math/log cfunction
(math/log x)

Returns log base natural number of x.

math/log10 cfunction
(math/log10 x)

Returns log base 10 of x.

math/log2 cfunction
(math/log2 x)

Returns log base 2 of x.

math/pi number
The value pi.

math/pow cfunction
(math/pow a x)

Return a to the power of x.

math/random cfunction
(math/random)

Returns a uniformly distributed random number between 0 and 1.

math/rng cfunction
(math/rng &opt seed)

Creates a Psuedo-Random number generator, with an optional seed. The seed should be an unsigned 32 bit integer. Do not use this for cryptography. Returns a core/rng abstract type.

math/rng-buffer cfunction
(math/rng-buffer rng n &opt buf)

Get n random bytes and put them in a buffer. Creates a new buffer if no buffer is provided, otherwise appends to the given buffer. Returns the buffer.

math/rng-int cfunction
(math/rng-int rng &opt max)

Extract a random random integer in the range [0, max] from the RNG. If no max is given, the default is 2^31 - 1.

math/rng-uniform cfunction
(math/rng-seed rng seed)

Extract a random number in the range [0, 1) from the RNG.

math/round cfunction
(math/round x)

Returns the integer nearest to x.

math/seedrandom cfunction
(math/seedrandom seed)

Set the seed for the random number generator. seed should be an integer or a buffer.

math/sin cfunction
(math/sin x)

Returns the sine of x.

math/sinh cfunction
(math/sinh x)

Return the hyperbolic sine of x.

math/sqrt cfunction
(math/sqrt x)

Returns the square root of x.

math/tan cfunction
(math/tan x)

Returns the tangent of x.

math/tanh cfunction
(math/tanh x)

Return the hyperbolic tangent of x.

math/trunc cfunction
(math/trunc x)

Returns the integer between x and 0 nearest to x.