PassiveSupport.Math (passive_support v0.8.4)

Mathematical functions.

I'm not great at math.

Link to this section Summary

Link to this section Functions

See :math.acos/1.

See :math.acosh/1.

See :math.asin/1.

See :math.asinh/1.

See :math.atan/1.

See :math.atan2/2.

See :math.atanh/1.

See Kernel.ceil/1.

See :math.cos/1.

See :math.cosh/1.

See :math.erf/1.

See :math.erfc/1.

See :math.exp/1.

See PassiveSupport.Integer.factorial/1.

See Kernel.floor/1.

See :math.fmod/2.

See :math.log/1.

See :math.log10/1.

See :math.log2/1.

See :math.pi/0.

Link to this function

pow(base, exponent)

Specs

pow(number(), number()) :: number()

Raises base to the power of exponent.

Since :math.pow/2 always does floating point arithmetic, whereas PassiveSupport.Integer.exponential/2 will do arbitrary precision arithmetic if the exponent is a positive integer, Math.pow/2 checks the types of base and exponent and delegates out to the appropriate function based on what it finds.

Examples

iex> pow(2, 5)
32

iex> pow(2, 5.0)
32.0

iex> pow(2, 200)
1606938044258990275541962092341162602522202993782792835301376

iex> pow(2.0, 2000)
** (ArithmeticError)

Specs

sign(number()) :: -1 | 0 | 1

Returns 1 if the number is positive, -1 if negative, and 0 if 0

See :math.sin/1.

See :math.sinh/1.

See :math.sqrt/1.

See :math.tan/1.

See :math.tanh/1.