# module Math

##
Extended Modules

- Math

##
Defined in:

##
Constant Summary

E = `LibM.exp_f64(1.0)`
LOG10 = `LibM.log_f64(10.0)`
LOG2 = `LibM.log_f64(2.0)`
PI = `3.14159265358979323846`

##
Instance Method Summary

- #acos(value : Float32)

  Calculates the acos of value.

- #acos(value : Float64)

  Calculates the acos of value.

- #acos(value)

  Calculates the acos of value.

- #acosh(value : Float32)

  Calculates the acosh of value.

- #acosh(value : Float64)

  Calculates the acosh of value.

- #acosh(value)

  Calculates the acosh of value.

- #asin(value : Float32)

  Calculates the asin of value.

- #asin(value : Float64)

  Calculates the asin of value.

- #asin(value)

  Calculates the asin of value.

- #asinh(value : Float32)

  Calculates the asinh of value.

- #asinh(value : Float64)

  Calculates the asinh of value.

- #asinh(value)

  Calculates the asinh of value.

- #atan(value)

  Calculates the atan of value.

- #atan(value : Float64)

  Calculates the atan of value.

- #atan(value : Float32)

  Calculates the atan of value.

- #atan2(value1 : Float32, value2 : Float32)

  Calculates atan2 with parameters value1 and value2.

- #atan2(value1 : Float64, value2 : Float64)

  Calculates atan2 with parameters value1 and value2.

- #atan2(value1, value2)

  Calculates atan2 with parameters value1 and value2.

- #atanh(value : Float32)

  Calculates the atanh of value.

- #atanh(value : Float64)

  Calculates the atanh of value.

- #atanh(value)

  Calculates the atanh of value.

- #besselj(value1 : Int32, value2 : Float64)

  Calculates besselj with parameters value1 and value2.

- #besselj(value1 : Int32, value2 : Float32)

  Calculates besselj with parameters value1 and value2.

- #besselj(value1, value2)

  Calculates besselj with parameters value1 and value2.

- #besselj0(value)

  Calculates the besselj0 function of value.

- #besselj0(value : Float64)

  Calculates the besselj0 function of value.

- #besselj0(value : Float32)

  Calculates the besselj0 function of value.

- #besselj1(value)

  Calculates the besselj1 function of value.

- #besselj1(value : Float64)

  Calculates the besselj1 function of value.

- #besselj1(value : Float32)

  Calculates the besselj1 function of value.

- #bessely(value1 : Int32, value2 : Float32)

  Calculates bessely with parameters value1 and value2.

- #bessely(value1 : Int32, value2 : Float64)

  Calculates bessely with parameters value1 and value2.

- #bessely(value1, value2)

  Calculates bessely with parameters value1 and value2.

- #bessely0(value : Float64)

  Calculates the bessely0 function of value.

- #bessely0(value)

  Calculates the bessely0 function of value.

- #bessely0(value : Float32)

  Calculates the bessely0 function of value.

- #bessely1(value)

  Calculates the bessely1 function of value.

- #bessely1(value : Float64)

  Calculates the bessely1 function of value.

- #bessely1(value : Float32)

  Calculates the bessely1 function of value.

- #cbrt(value)

  Calculates the cbrt of value.

- #cbrt(value : Float64)

  Calculates the cbrt of value.

- #cbrt(value : Float32)

  Calculates the cbrt of value.

- #copysign(value1, value2)

  Calculates copysign with parameters value1 and value2.

- #copysign(value1 : Float64, value2 : Float64)

  Calculates copysign with parameters value1 and value2.

- #copysign(value1 : Float32, value2 : Float32)

  Calculates copysign with parameters value1 and value2.

- #cos(value : Float64)

  Calculates the cos of value.

- #cos(value : Float32)

  Calculates the cos of value.

- #cos(value)

  Calculates the cos of value.

- #cosh(value : Float32)

  Calculates the cosh of value.

- #cosh(value : Float64)

  Calculates the cosh of value.

- #cosh(value)

  Calculates the cosh of value.

- #erf(value : Float32)

  Calculates the erf of value.

- #erf(value : Float64)

  Calculates the erf of value.

- #erf(value)

  Calculates the erf of value.

- #erfc(value : Float32)

  Calculates the erfc of value.

- #erfc(value : Float64)

  Calculates the erfc of value.

- #erfc(value)

  Calculates the erfc of value.

- #exp(value : Float32)

  Calculates the exp of value.

- #exp(value : Float64)

  Calculates the exp of value.

- #exp(value)

  Calculates the exp of value.

- #exp2(value : Float64)

  Calculates the exp2 of value.

- #exp2(value)

  Calculates the exp2 of value.

- #exp2(value : Float32)

  Calculates the exp2 of value.

- #expm1(value : Float32)

  Calculates the expm1 of value.

- #expm1(value : Float64)

  Calculates the expm1 of value.

- #expm1(value)

  Calculates the expm1 of value.

- #frexp(value)

  Decomposes given floating point value into a normalized fraction and an integral power of two.

- #frexp(value : BigFloat)
- #frexp(value : Float64)

  Decomposes given floating point value into a normalized fraction and an integral power of two.

- #frexp(value : Float32)

  Decomposes given floating point value into a normalized fraction and an integral power of two.

- #gamma(value : Float64)

  Calculates the gamma function of value.

- #gamma(value)

  Calculates the gamma function of value.

- #gamma(value : Float32)

  Calculates the gamma function of value.

- #hypot(value1 : Float32, value2 : Float32)

  Calculates hypot with parameters value1 and value2.

- #hypot(value1 : Float64, value2 : Float64)

  Calculates hypot with parameters value1 and value2.

- #hypot(value1, value2)

  Calculates hypot with parameters value1 and value2.

- #ilogb(value : Float32)

  Calculates the ilogb of value.

- #ilogb(value : Float64)

  Calculates the ilogb of value.

- #ilogb(value)

  Calculates the ilogb of value.

- #ldexp(value1 : Float32, value2 : Int32)

  Calculates ldexp with parameters value1 and value2.

- #ldexp(value1 : Float64, value2 : Int32)

  Calculates ldexp with parameters value1 and value2.

- #ldexp(value1, value2)

  Calculates ldexp with parameters value1 and value2.

- #lgamma(value)

  Calculates the logarithmic gamma of value.

- #lgamma(value : Float64)

  Calculates the logarithmic gamma of value.

- #lgamma(value : Float32)

  Calculates the logarithmic gamma of value.

- #log(numeric, base)

  Returns the logarithm of numeric to the base base.

- #log(value : Float64)

  Calculates the log of value.

- #log(value)

  Calculates the log of value.

- #log(value : Float32)

  Calculates the log of value.

- #log10(value : Float32)

  Calculates the log10 of value.

- #log10(value)

  Calculates the log10 of value.

- #log10(value : Float64)

  Calculates the log10 of value.

- #log1p(value)

  Calculates the log1p of value.

- #log1p(value : Float64)

  Calculates the log1p of value.

- #log1p(value : Float32)

  Calculates the log1p of value.

- #log2(value)

  Calculates the log2 of value.

- #log2(value : Float64)

  Calculates the log2 of value.

- #log2(value : Float32)

  Calculates the log2 of value.

- #logb(value)

  Calculates the logb of value.

- #logb(value : Float64)

  Calculates the logb of value.

- #logb(value : Float32)

  Calculates the logb of value.

- #max(value1 : Float64, value2 : Float64)
- #max(value1, value2)

  Returns the greater of value1 and value2.

- #max(value1 : Float32, value2 : Float32)
- #min(value1 : Float32, value2 : Float32)
- #min(value1 : Float64, value2 : Float64)
- #min(value1, value2)

  Returns the smaller of value1 and value2.

- #pw2ceil(v)

  Computes the next highest power of 2 of v.

- #scalbln(value, exp)

  Multiplies value by 2 raised to power exp.

- #scalbln(value : Float64, exp : Int64)

  Multiplies value by 2 raised to power exp.

- #scalbln(value : Float32, exp : Int64)

  Multiplies value by 2 raised to power exp.

- #scalbn(value1, value2)

  Calculates scalbn with parameters value1 and value2.

- #scalbn(value1 : Float64, value2 : Int32)

  Calculates scalbn with parameters value1 and value2.

- #scalbn(value1 : Float32, value2 : Int32)

  Calculates scalbn with parameters value1 and value2.

- #sin(value : Float32)

  Calculates the sin of value.

- #sin(value : Float64)

  Calculates the sin of value.

- #sin(value)

  Calculates the sin of value.

- #sinh(value : Float32)

  Calculates the sinh of value.

- #sinh(value : Float64)

  Calculates the sinh of value.

- #sinh(value)

  Calculates the sinh of value.

- #sqrt(value : Float32)

  Calculates the sqrt of value.

- #sqrt(value : Float64)

  Calculates the sqrt of value.

- #sqrt(value : BigInt)

  Returns the sqrt of a `BigInt`.

- #sqrt(value : BigFloat)

  Returns the sqrt of a `BigFloat`.

- #sqrt(value : BigRational)

  Returns the sqrt of a `BigRational`.

- #sqrt(value)

  Calculates the sqrt of value.

- #tan(value : Float32)

  Calculates the tan of value.

- #tan(value : Float64)

  Calculates the tan of value.

- #tan(value)

  Calculates the tan of value.

- #tanh(value : Float32)

  Calculates the tanh of value.

- #tanh(value : Float64)

  Calculates the tanh of value.

- #tanh(value)

  Calculates the tanh of value.

##
Instance Method Detail

def acos(value : Float32) #

Calculates the acos of value.

def acos(value : Float64) #

Calculates the acos of value.

def acos(value) #

Calculates the acos of value.

def acosh(value : Float32) #

Calculates the acosh of value.

def acosh(value : Float64) #

Calculates the acosh of value.

def acosh(value) #

Calculates the acosh of value.

def asin(value : Float32) #

Calculates the asin of value.

def asin(value : Float64) #

Calculates the asin of value.

def asin(value) #

Calculates the asin of value.

def asinh(value : Float32) #

Calculates the asinh of value.

def asinh(value : Float64) #

Calculates the asinh of value.

def asinh(value) #

Calculates the asinh of value.

def atan(value) #

Calculates the atan of value.

def atan(value : Float64) #

Calculates the atan of value.

def atan(value : Float32) #

Calculates the atan of value.

def atan2(value1 : Float32, value2 : Float32) #

Calculates atan2 with parameters value1 and value2.

def atan2(value1 : Float64, value2 : Float64) #

Calculates atan2 with parameters value1 and value2.

def atan2(value1, value2) #

Calculates atan2 with parameters value1 and value2.

def atanh(value : Float32) #

Calculates the atanh of value.

def atanh(value : Float64) #

Calculates the atanh of value.

def atanh(value) #

Calculates the atanh of value.

def besselj(value1 : Int32, value2 : Float64) #

Calculates besselj with parameters value1 and value2.

def besselj(value1 : Int32, value2 : Float32) #

Calculates besselj with parameters value1 and value2.

def besselj(value1, value2) #

Calculates besselj with parameters value1 and value2.

def besselj0(value) #

Calculates the besselj0 function of value.

def besselj0(value : Float64) #

Calculates the besselj0 function of value.

def besselj0(value : Float32) #

Calculates the besselj0 function of value.

def besselj1(value) #

Calculates the besselj1 function of value.

def besselj1(value : Float64) #

Calculates the besselj1 function of value.

def besselj1(value : Float32) #

Calculates the besselj1 function of value.

def bessely(value1 : Int32, value2 : Float32) #

Calculates bessely with parameters value1 and value2.

def bessely(value1 : Int32, value2 : Float64) #

Calculates bessely with parameters value1 and value2.

def bessely(value1, value2) #

Calculates bessely with parameters value1 and value2.

def bessely0(value : Float64) #

Calculates the bessely0 function of value.

def bessely0(value) #

Calculates the bessely0 function of value.

def bessely0(value : Float32) #

Calculates the bessely0 function of value.

def bessely1(value) #

Calculates the bessely1 function of value.

def bessely1(value : Float64) #

Calculates the bessely1 function of value.

def bessely1(value : Float32) #

Calculates the bessely1 function of value.

def cbrt(value) #

Calculates the cbrt of value.

def cbrt(value : Float64) #

Calculates the cbrt of value.

def cbrt(value : Float32) #

Calculates the cbrt of value.

def copysign(value1, value2) #

Calculates copysign with parameters value1 and value2.

def copysign(value1 : Float64, value2 : Float64) #

Calculates copysign with parameters value1 and value2.

def copysign(value1 : Float32, value2 : Float32) #

Calculates copysign with parameters value1 and value2.

def cos(value : Float64) #

Calculates the cos of value.

def cos(value : Float32) #

Calculates the cos of value.

def cos(value) #

Calculates the cos of value.

def cosh(value : Float32) #

Calculates the cosh of value.

def cosh(value : Float64) #

Calculates the cosh of value.

def cosh(value) #

Calculates the cosh of value.

def erf(value : Float32) #

Calculates the erf of value.

def erf(value : Float64) #

Calculates the erf of value.

def erf(value) #

Calculates the erf of value.

def erfc(value : Float32) #

Calculates the erfc of value.

def erfc(value : Float64) #

Calculates the erfc of value.

def erfc(value) #

Calculates the erfc of value.

def exp(value : Float32) #

Calculates the exp of value.

def exp(value : Float64) #

Calculates the exp of value.

def exp(value) #

Calculates the exp of value.

def exp2(value : Float64) #

Calculates the exp2 of value.

def exp2(value) #

Calculates the exp2 of value.

def exp2(value : Float32) #

Calculates the exp2 of value.

def expm1(value : Float32) #

Calculates the expm1 of value.

def expm1(value : Float64) #

Calculates the expm1 of value.

def expm1(value) #

Calculates the expm1 of value.

def frexp(value) #

Decomposes given floating point value into a normalized fraction and an integral power of two.

def frexp(value : BigFloat) #
def frexp(value : Float64) #

Decomposes given floating point value into a normalized fraction and an integral power of two.

def frexp(value : Float32) #

Decomposes given floating point value into a normalized fraction and an integral power of two.

def gamma(value : Float64) #

Calculates the gamma function of value.

Note that `#gamma(n)` is same as `fact(n - 1)` for integer `n > 0`. However `#gamma(n)` returns float and can be an approximation.

def gamma(value) #

Calculates the gamma function of value.

Note that `#gamma(n)` is same as `fact(n - 1)` for integer `n > 0`. However `#gamma(n)` returns float and can be an approximation.

def gamma(value : Float32) #

Calculates the gamma function of value.

Note that `#gamma(n)` is same as `fact(n - 1)` for integer `n > 0`. However `#gamma(n)` returns float and can be an approximation.

def hypot(value1 : Float32, value2 : Float32) #

Calculates hypot with parameters value1 and value2.

def hypot(value1 : Float64, value2 : Float64) #

Calculates hypot with parameters value1 and value2.

def hypot(value1, value2) #

Calculates hypot with parameters value1 and value2.

def ilogb(value : Float32) #

Calculates the ilogb of value.

def ilogb(value : Float64) #

Calculates the ilogb of value.

def ilogb(value) #

Calculates the ilogb of value.

def ldexp(value1 : Float32, value2 : Int32) #

Calculates ldexp with parameters value1 and value2.

def ldexp(value1 : Float64, value2 : Int32) #

Calculates ldexp with parameters value1 and value2.

def ldexp(value1, value2) #

Calculates ldexp with parameters value1 and value2.

def lgamma(value) #

Calculates the logarithmic gamma of value.

    Math.lgamma(2.96)

is the same as

    Math.log(Math.gamma(2.96).abs)

def lgamma(value : Float64) #

Calculates the logarithmic gamma of value.

    Math.lgamma(2.96)

is the same as

    Math.log(Math.gamma(2.96).abs)

def lgamma(value : Float32) #

Calculates the logarithmic gamma of value.

    Math.lgamma(2.96)

is the same as

    Math.log(Math.gamma(2.96).abs)

def log(numeric, base) #

Returns the logarithm of numeric to the base base.

def log(value : Float64) #

Calculates the log of value.

def log(value) #

Calculates the log of value.

def log(value : Float32) #

Calculates the log of value.

def log10(value : Float32) #

Calculates the log10 of value.

def log10(value) #

Calculates the log10 of value.

def log10(value : Float64) #

Calculates the log10 of value.

def log1p(value) #

Calculates the log1p of value.

def log1p(value : Float64) #

Calculates the log1p of value.

def log1p(value : Float32) #

Calculates the log1p of value.

def log2(value) #

Calculates the log2 of value.

def log2(value : Float64) #

Calculates the log2 of value.

def log2(value : Float32) #

Calculates the log2 of value.

def logb(value) #

Calculates the logb of value.

def logb(value : Float64) #

Calculates the logb of value.

def logb(value : Float32) #

Calculates the logb of value.

def max(value1 : Float64, value2 : Float64) #
def max(value1, value2) #

Returns the greater of value1 and value2.

def max(value1 : Float32, value2 : Float32) #
def min(value1 : Float32, value2 : Float32) #
def min(value1 : Float64, value2 : Float64) #
def min(value1, value2) #

Returns the smaller of value1 and value2.

def pw2ceil(v) #

Computes the next highest power of 2 of v.

    Math.pw2ceil(33) # => 64

def scalbln(value, exp) #

Multiplies value by 2 raised to power exp.

def scalbln(value : Float64, exp : Int64) #

Multiplies value by 2 raised to power exp.

def scalbln(value : Float32, exp : Int64) #

Multiplies value by 2 raised to power exp.

def scalbn(value1, value2) #

Calculates scalbn with parameters value1 and value2.

def scalbn(value1 : Float64, value2 : Int32) #

Calculates scalbn with parameters value1 and value2.

def scalbn(value1 : Float32, value2 : Int32) #

Calculates scalbn with parameters value1 and value2.

def sin(value : Float32) #

Calculates the sin of value.

def sin(value : Float64) #

Calculates the sin of value.

def sin(value) #

Calculates the sin of value.

def sinh(value : Float32) #

Calculates the sinh of value.

def sinh(value : Float64) #

Calculates the sinh of value.

def sinh(value) #

Calculates the sinh of value.

def sqrt(value : Float32) #

Calculates the sqrt of value.

def sqrt(value : Float64) #

Calculates the sqrt of value.

def sqrt(value : BigInt) #

Returns the sqrt of a `BigInt`.

    require "big"

    Math.sqrt((1000_000_000_0000.to_big_i*1000_000_000_00000.to_big_i))

def sqrt(value : BigFloat) #

Returns the sqrt of a `BigFloat`.

    require "big"
    Math.sqrt((1000_000_000_0000.to_big_f*1000_000_000_00000.to_big_f))

def sqrt(value : BigRational) #

Returns the sqrt of a `BigRational`.

    require "big"

    Math.sqrt((1000_000_000_0000.to_big_r*1000_000_000_00000.to_big_r))

def sqrt(value) #

Calculates the sqrt of value.

def tan(value : Float32) #

Calculates the tan of value.

def tan(value : Float64) #

Calculates the tan of value.

def tan(value) #

Calculates the tan of value.

def tanh(value : Float32) #

Calculates the tanh of value.

def tanh(value : Float64) #

Calculates the tanh of value.

def tanh(value) #

Calculates the tanh of value.