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.

``type Radians = Number``

An alias to make types in this module more explicit.

### #absSource

``abs :: Number -> Number``

Returns the absolute value of the argument.

### #acosSource

``acos :: Number -> Radians``

Returns the inverse cosine of the argument.

### #asinSource

``asin :: Number -> Radians``

Returns the inverse sine of the argument.

### #atanSource

``atan :: Number -> Radians``

Returns the inverse tangent of the argument.

### #atan2Source

``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)`.

### #ceilSource

``ceil :: Number -> Number``

Returns the smallest integer not smaller than the argument.

### #cosSource

``cos :: Radians -> Number``

Returns the cosine of the argument.

### #expSource

``exp :: Number -> Number``

Returns `e` exponentiated to the power of the argument.

### #floorSource

``floor :: Number -> Number``

Returns the largest integer not larger than the argument.

### #logSource

``log :: Number -> Number``

Returns the natural logarithm of a number.

### #maxSource

``max :: Number -> Number -> Number``

Returns the largest of two numbers.

### #minSource

``min :: Number -> Number -> Number``

Returns the smallest of two numbers.

### #powSource

``pow :: Number -> Number -> Number``

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

### #roundSource

``round :: Number -> Number``

Returns the integer closest to the argument.

### #sinSource

``sin :: Radians -> Number``

Returns the sine of the argument.

### #sqrtSource

``sqrt :: Number -> Number``

Returns the square root of the argument.

### #tanSource

``tan :: Radians -> Number``

Returns the tangent of the argument.

### #truncSource

``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.

### #remainderSource

``remainder :: Number -> Number -> Number``

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

### #(%)Source

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

### #eSource

``e :: Number``

The base of natural logarithms, e, around 2.71828.

### #ln2Source

``ln2 :: Number``

The natural logarithm of 2, around 0.6931.

### #ln10Source

``ln10 :: Number``

The natural logarithm of 10, around 2.3025.

### #log2eSource

``log2e :: Number``

The base 2 logarithm of `e`, around 1.4426.

### #log10eSource

``log10e :: Number``

Base 10 logarithm of `e`, around 0.43429.

### #piSource

``pi :: Number``

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

### #tauSource

``tau :: Number``

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

### #sqrt1_2Source

``sqrt1_2 :: Number``

The Square root of one half, around 0.707107.

### #sqrt2Source

``sqrt2 :: Number``

The square root of two, around 1.41421.

Modules
Math