Module

Math

Wraps the math functions and constants from Javascript's built-in Math object. See Math Reference at MDN.

#Radians

type Radians = Number

An alias to make types in this module more explicit.

#abs

abs :: Number -> Number

Returns the absolute value of the argument.

#acos

acos :: Number -> Radians

Returns the inverse cosine of the argument.

#asin

asin :: Number -> Radians

Returns the inverse sine of the argument.

#atan

atan :: Number -> Radians

Returns the inverse tangent of the argument.

#atan2

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

ceil :: Number -> Number

Returns the smallest integer not smaller than the argument.

#cos

cos :: Radians -> Number

Returns the cosine of the argument.

#exp

exp :: Number -> Number

Returns e exponentiated to the power of the argument.

#floor

floor :: Number -> Number

Returns the largest integer not larger than the argument.

#log

log :: Number -> Number

Returns the natural logarithm of a number.

#max

max :: Number -> Number -> Number

Returns the largest of two numbers.

#min

min :: Number -> Number -> Number

Returns the smallest of two numbers.

#pow

pow :: Number -> Number -> Number

Return the first argument exponentiated to the power of the second argument.

#round

round :: Number -> Number

Returns the integer closest to the argument.

#sin

sin :: Radians -> Number

Returns the sine of the argument.

#sqrt

sqrt :: Number -> Number

Returns the square root of the argument.

#tan

tan :: Radians -> Number

Returns the tangent of the argument.

#trunc

trunc :: Number -> Number

Truncates the decimal portion of a number. Equivalent to floor if the number is positive, and ceil if the number is negative.

#remainder

remainder :: Number -> Number -> Number

Computes the remainder after division, wrapping Javascript's % operator.

#(%)

Operator alias for Math.remainder (left-associative / precedence 7)

#e

e :: Number

The base of natural logarithms, e, around 2.71828.

#ln2

ln2 :: Number

The natural logarithm of 2, around 0.6931.

#ln10

ln10 :: Number

The natural logarithm of 10, around 2.3025.

#log2e

log2e :: Number

The base 2 logarithm of e, around 1.4426.

#log10e

log10e :: Number

Base 10 logarithm of e, around 0.43429.

#pi

pi :: Number

The ratio of the circumference of a circle to its diameter, around 3.14159.

#tau

tau :: Number

The ratio of the circumference of a circle to its radius, around 6.283185.

#sqrt1_2

sqrt1_2 :: Number

The Square root of one half, around 0.707107.

#sqrt2

sqrt2 :: Number

The square root of two, around 1.41421.

Modules