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 .

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.

Functions

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

Inverse cosine of X, return value is in radians.

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

Inverse hyperbolic cosine of X.

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

Inverse sine of X, return value is in radians.

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

Inverse hyperbolic sine of X.

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

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

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

Inverse tangent of X, return value is in radians.

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

Inverse hyperbolic tangent of X.

Link to this function

ceil(X)

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

The ceiling of X.

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

The cosine of X in radians.

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

The hyperbolic cosine of X.

-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.
-spec erfc(X) -> float() when X :: number().

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

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

Raise e by X, that is .

Where e is the base of the natural logarithm.

Link to this function

floor(X)

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

The floor of X.

Link to this function

fmod(X, Y)

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

Returns X modulus Y.

Link to this function

log2(X)

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

The base-2 logarithm of X.

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

The base-10 logarithm of X.

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

The natural (base-e) logarithm of X.

-spec pi() -> float().

Ratio of the circumference of a circle to its diameter.

Floating point approximation of mathematical constant pi.

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

Raise X by N, that is xⁿ.

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

Sine of X in radians.

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

Hyperbolic sine of X.

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

Square root of X.

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

Tangent of X in radians.

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

Hyperbolic tangent of X.

-spec tau() -> float().

Ratio of the circumference of a circle to its radius.

This constant is equivalent to a full turn when described in radians.

The same as 2 * pi().