Module

Math

Package
math
Repository
purerl/purescript-math

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

#Radians Source

type Radians = Number

An alias to make types in this module more explicit.

#abs Source

abs :: Number -> Number

Returns the absolute value of the argument.

#acos Source

acos :: Number -> Radians

Returns the inverse cosine of the argument.

#asin Source

asin :: Number -> Radians

Returns the inverse sine of the argument.

#atan Source

atan :: Number -> Radians

Returns the inverse tangent of the argument.

#atan2 Source

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 Source

ceil :: Number -> Number

Returns the smallest integer not smaller than the argument.

#cos Source

cos :: Radians -> Number

Returns the cosine of the argument.

#exp Source

exp :: Number -> Number

Returns e exponentiated to the power of the argument.

#floor Source

floor :: Number -> Number

Returns the largest integer not larger than the argument.

#log Source

log :: Number -> Number

Returns the natural logarithm of a number.

#max Source

max :: Number -> Number -> Number

Returns the largest of two numbers.

#min Source

min :: Number -> Number -> Number

Returns the smallest of two numbers.

#pow Source

pow :: Number -> Number -> Number

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

#round Source

round :: Number -> Number

Returns the integer closest to the argument.

#sin Source

sin :: Radians -> Number

Returns the sine of the argument.

#sqrt Source

sqrt :: Number -> Number

Returns the square root of the argument.

#tan Source

tan :: Radians -> Number

Returns the tangent of the argument.

#trunc Source

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 Source

remainder :: Number -> Number -> Number

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

#(%) Source

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

#e Source

e :: Number

The base of natural logarithms, e, around 2.71828.

#ln2 Source

ln2 :: Number

The natural logarithm of 2, around 0.6931.

#ln10 Source

ln10 :: Number

The natural logarithm of 10, around 2.3025.

#log2e Source

log2e :: Number

The base 2 logarithm of e, around 1.4426.

#log10e Source

log10e :: Number

Base 10 logarithm of e, around 0.43429.

#pi Source

pi :: Number

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

#tau Source

tau :: Number

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

#sqrt1_2 Source

sqrt1_2 :: Number

The Square root of one half, around 0.707107.

#sqrt2 Source

sqrt2 :: Number

The square root of two, around 1.41421.

Modules
Math