# View Source math(stdlib v6.0.1)

Mathematical functions.

This module provides an interface to a number of mathematical functions. For details about what each function does, see the the C library documentation on your system. On Unix systems the easiest way it to run `man sin`. On Windows you should check the Math and floating-point support documentation.

## Limitations

As these are the C library, the same limitations apply.

# Summary

## Functions

Inverse cosine of `X`, return value is in radians.

Inverse hyperbolic cosine of `X`.

Inverse sine of `X`, return value is in radians.

Inverse hyperbolic sine of `X`.

Inverse 2-argument tangent of `X`, return value is in radians.

Inverse tangent of `X`, return value is in radians.

Inverse hyperbolic tangent of `X`.

The ceiling of `X`.

The cosine of `X` in radians.

The hyperbolic cosine of `X`.

Returns the error function (or Gauss error function) of `X`.

`erfc(X)` returns `1.0` - `erf(X)`, computed by methods that avoid cancellation for large `X`.

Raise e by `X`, that is `eˣ`.

The floor of `X`.

Returns `X` modulus `Y`.

The base-2 logarithm of `X`.

The base-10 logarithm of `X`.

The natural (base-e) logarithm of `X`.

Ratio of the circumference of a circle to its diameter.

Raise `X` by `N`, that is `xⁿ`.

Sine of `X` in radians.

Hyperbolic sine of `X`.

Square root of `X`.

Tangent of `X` in radians.

Hyperbolic tangent of `X`.

Ratio of the circumference of a circle to its radius.

# acos(X)

View Source
`-spec acos(X) -> float() when X :: number().`

Inverse cosine of `X`, return value is in radians.

# acosh(X)

View Source
`-spec acosh(X) -> float() when X :: number().`

Inverse hyperbolic cosine of `X`.

# asin(X)

View Source
`-spec asin(X) -> float() when X :: number().`

Inverse sine of `X`, return value is in radians.

# asinh(X)

View Source
`-spec asinh(X) -> float() when X :: number().`

Inverse hyperbolic sine of `X`.

# atan2(Y, X)

View Source
`-spec atan2(Y, X) -> float() when Y :: number(), X :: number().`

Inverse 2-argument tangent of `X`, return value is in radians.

# atan(X)

View Source
`-spec atan(X) -> float() when X :: number().`

Inverse tangent of `X`, return value is in radians.

# atanh(X)

View Source
`-spec atanh(X) -> float() when X :: number().`

Inverse hyperbolic tangent of `X`.

# ceil(X)

View Source (since OTP 20.0)
`-spec ceil(X) -> float() when X :: number().`

The ceiling of `X`.

# cos(X)

View Source
`-spec cos(X) -> float() when X :: number().`

The cosine of `X` in radians.

# cosh(X)

View Source
`-spec cosh(X) -> float() when X :: number().`

The hyperbolic cosine of `X`.

# erf(X)

View Source
`-spec erf(X) -> float() when X :: number().`

Returns the error function (or Gauss error function) of `X`.

Where:

``erf(X) = 2/sqrt(pi)*integral from 0 to X of exp(-t*t) dt.``

# erfc(X)

View Source
`-spec erfc(X) -> float() when X :: number().`

`erfc(X)` returns `1.0` - `erf(X)`, computed by methods that avoid cancellation for large `X`.

# exp(X)

View Source
`-spec exp(X) -> float() when X :: number().`

Raise e by `X`, that is `eˣ`.

Where e is the base of the natural logarithm.

# floor(X)

View Source (since OTP 20.0)
`-spec floor(X) -> float() when X :: number().`

The floor of `X`.

# fmod(X, Y)

View Source (since OTP 20.0)
`-spec fmod(X, Y) -> float() when X :: number(), Y :: number().`

Returns `X` modulus `Y`.

# log2(X)

View Source (since OTP 18.0)
`-spec log2(X) -> float() when X :: number().`

The base-2 logarithm of `X`.

# log10(X)

View Source
`-spec log10(X) -> float() when X :: number().`

The base-10 logarithm of `X`.

# log(X)

View Source
`-spec log(X) -> float() when X :: number().`

The natural (base-e) logarithm of `X`.

# pi()

View Source
`-spec pi() -> float().`

Ratio of the circumference of a circle to its diameter.

Floating point approximation of mathematical constant pi.

# pow(X, N)

View Source
`-spec pow(X, N) -> float() when X :: number(), N :: number().`

Raise `X` by `N`, that is `xⁿ`.

# sin(X)

View Source
`-spec sin(X) -> float() when X :: number().`

Sine of `X` in radians.

# sinh(X)

View Source
`-spec sinh(X) -> float() when X :: number().`

Hyperbolic sine of `X`.

# sqrt(X)

View Source
`-spec sqrt(X) -> float() when X :: number().`

Square root of `X`.

# tan(X)

View Source
`-spec tan(X) -> float() when X :: number().`

Tangent of `X` in radians.

# tanh(X)

View Source
`-spec tanh(X) -> float() when X :: number().`

Hyperbolic tangent of `X`.

`-spec tau() -> float().`
The same as `2 * pi()`.