Novah Documentation

novah.math

Common mathematical functions and constants.

Types

Declarations


e

visibility: public
type: Float64

The base of natural logarithms.


pi

visibility: public
type: Float64

The ratio of the circumference of a circle to its diameter.


min

visibility: public
type: {{ NumberOps a }} -> a -> a -> a

Returns the smaller of two numbers.


max

visibility: public
type: {{ NumberOps a }} -> a -> a -> a

Returns the bigger of two numbers.


abs

visibility: public
type: {{ NumberOps a }} -> a -> a

Returns the absolute value of the input.


isOdd

visibility: public
type: {{ NumberOps a }} -> a -> Boolean

Returns true if this number is odd.


isEven

visibility: public
type: {{ NumberOps a }} -> a -> Boolean

Returns true if this number is even.


clamp

visibility: public
type: {{ NumberOps a }} -> a -> a -> a -> a

Returns n clamped between min and max.


sin

visibility: public
type: Float64 -> Float64

Returns the trigonometric sine of an angle (in radians).


cos

visibility: public
type: Float64 -> Float64

Returns the trigonometric cosine of an angle (in radians).


tan

visibility: public
type: Float64 -> Float64

Returns the trigonometric tangent of an angle (in radians).


asin

visibility: public
type: Float64 -> Float64

Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.


acos

visibility: public
type: Float64 -> Float64

Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.


atan

visibility: public
type: Float64 -> Float64

Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2.


toRadians

visibility: public
type: Float64 -> Float64

Converts an angle in degrees to its approximation in radians.


toDegrees

visibility: public
type: Float64 -> Float64

Converts an angle in radians to its approximation in degrees.


exp

visibility: public
type: Float64 -> Float64

Returns Euler's number e raised to the power of x.


log

visibility: public
type: Float64 -> Float64

Returns the natural logarithm (base e) of x.


log10

visibility: public
type: Float64 -> Float64

Returns the base 10 logarithm of x.


sqrt

visibility: public
type: Float64 -> Float64

Returns the square root of x.


cbrt

visibility: public
type: Float64 -> Float64

Returns the cube root of x.


ceil

visibility: public
type: Float64 -> Float64

Returns the smallest Float64 number that is greater than x and equals to an integer (round up).


floor

visibility: public
type: Float64 -> Float64

Returns the greatest Float64 number that is less than or equal x and equals to an integer (round down).


round

visibility: public
type: Float32 -> Int32

Returns the Int32 closest to x.


round64

visibility: public
type: Float64 -> Int64

Returns the Int64 closest to x.