Wraps the math functions and constants from Javascript's built-in Math
object.
See Math Reference at MDN.
type Radians = Number
An alias to make types in this module more explicit.
abs :: Number -> Number
Returns the absolute value of the argument.
acos :: Number -> Radians
Returns the inverse cosine of the argument.
asin :: Number -> Radians
Returns the inverse sine of the argument.
atan :: Number -> Radians
Returns the inverse tangent of the argument.
atan2 :: Number -> Number -> Radians
Four-quadrant tangent inverse. Given the arguments y
and x
, returns
the inverse tangent of y / x
, where the signs of both arguments are used
to determine the sign of the result.
If the first argument is negative, the result will be negative.
The result is the angle between the positive x axis and a point (x, y)
.
ceil :: Number -> Int
Returns the smallest integer not smaller than the argument.
cos :: Radians -> Number
Returns the cosine of the argument.
exp :: Number -> Number
Returns e
exponentiated to the power of the argument.
floor :: Number -> Int
Returns the largest integer not larger than the argument.
log :: Number -> Number
Returns the natural logarithm of a number.
max :: Number -> Number -> Number
Returns the largest of two numbers.
min :: Number -> Number -> Number
Returns the smallest of two numbers.
pow :: Number -> Number -> Number
Return the first argument exponentiated to the power of the second argument.
round :: Number -> Int
Returns the integer closest to the argument.
sin :: Radians -> Number
Returns the sine of the argument.
sqrt :: Number -> Number
Returns the square root of the argument.
tan :: Radians -> Number
Returns the tangent of the argument.
(%) :: Number -> Number -> Int
left-associative / precedence 7
Computes the remainder after division, wrapping Javascript's %
operator.
e :: Number
The base of natural logarithms, e, around 2.71828.
ln2 :: Number
The natural logarithm of 2, around 0.6931.
ln10 :: Number
The natural logarithm of 10, around 2.3025.
log2e :: Number
The base 2 logarithm of e
, around 1.4426.
log10e :: Number
Base 10 logarithm of e
, around 0.43429.
pi :: Number
The ratio of the circumference of a circle to its diameter, around 3.14159.
sqrt1_2 :: Number
The Square root of one half, around 0.707107.
sqrt2 :: Number
The square root of two, around 1.41421.