module Math

Extended Modules

Defined in:

math/math.cr

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

Instance Method Detail

def acos(value) #

Calculates the acos of value


[View source]
def acos(value : Float64) #

Calculates the acos of value


[View source]
def acos(value : Float32) #

Calculates the acos of value


[View source]
def acosh(value) #

Calculates the acosh of value


[View source]
def acosh(value : Float64) #

Calculates the acosh of value


[View source]
def acosh(value : Float32) #

Calculates the acosh of value


[View source]
def asin(value) #

Calculates the asin of value


[View source]
def asin(value : Float64) #

Calculates the asin of value


[View source]
def asin(value : Float32) #

Calculates the asin of value


[View source]
def asinh(value) #

Calculates the asinh of value


[View source]
def asinh(value : Float64) #

Calculates the asinh of value


[View source]
def asinh(value : Float32) #

Calculates the asinh of value


[View source]
def atan(value) #

Calculates the atan of value


[View source]
def atan(value : Float64) #

Calculates the atan of value


[View source]
def atan(value : Float32) #

Calculates the atan of value


[View source]
def atan2(value1, value2) #

Calculates atan2 with parameters value1 and value2


[View source]
def atan2(value1 : Float64, value2 : Float64) #

Calculates atan2 with parameters value1 and value2


[View source]
def atan2(value1 : Float32, value2 : Float32) #

Calculates atan2 with parameters value1 and value2


[View source]
def atanh(value : Float32) #

Calculates the atanh of value


[View source]
def atanh(value : Float64) #

Calculates the atanh of value


[View source]
def atanh(value) #

Calculates the atanh of value


[View source]
def besselj(value1 : Int32, value2 : Float32) #

Calculates besselj with parameters value1 and value2


[View source]
def besselj(value1, value2) #

Calculates besselj with parameters value1 and value2


[View source]
def besselj(value1 : Int32, value2 : Float64) #

Calculates besselj with parameters value1 and value2


[View source]
def besselj0(value) #

Calculates the besselj0 function of value


[View source]
def besselj0(value : Float64) #

Calculates the besselj0 function of value


[View source]
def besselj0(value : Float32) #

Calculates the besselj0 function of value


[View source]
def besselj1(value) #

Calculates the besselj1 function of value


[View source]
def besselj1(value : Float64) #

Calculates the besselj1 function of value


[View source]
def besselj1(value : Float32) #

Calculates the besselj1 function of value


[View source]
def bessely(value1 : Int32, value2 : Float32) #

Calculates bessely with parameters value1 and value2


[View source]
def bessely(value1, value2) #

Calculates bessely with parameters value1 and value2


[View source]
def bessely(value1 : Int32, value2 : Float64) #

Calculates bessely with parameters value1 and value2


[View source]
def bessely0(value) #

Calculates the bessely0 function of value


[View source]
def bessely0(value : Float32) #

Calculates the bessely0 function of value


[View source]
def bessely0(value : Float64) #

Calculates the bessely0 function of value


[View source]
def bessely1(value : Float64) #

Calculates the bessely1 function of value


[View source]
def bessely1(value : Float32) #

Calculates the bessely1 function of value


[View source]
def bessely1(value) #

Calculates the bessely1 function of value


[View source]
def cbrt(value : Float64) #

Calculates the cbrt of value


[View source]
def cbrt(value) #

Calculates the cbrt of value


[View source]
def cbrt(value : Float32) #

Calculates the cbrt of value


[View source]
def copysign(value1 : Float32, value2 : Float32) #

Calculates copysign with parameters value1 and value2


[View source]
def copysign(value1 : Float64, value2 : Float64) #

Calculates copysign with parameters value1 and value2


[View source]
def copysign(value1, value2) #

Calculates copysign with parameters value1 and value2


[View source]
def cos(value : Float32) #

Calculates the cos of value


[View source]
def cos(value : Float64) #

Calculates the cos of value


[View source]
def cos(value) #

Calculates the cos of value


[View source]
def cosh(value : Float32) #

Calculates the cosh of value


[View source]
def cosh(value : Float64) #

Calculates the cosh of value


[View source]
def cosh(value) #

Calculates the cosh of value


[View source]
def erf(value : Float32) #

Calculates the erf of value


[View source]
def erf(value : Float64) #

Calculates the erf of value


[View source]
def erf(value) #

Calculates the erf of value


[View source]
def erfc(value) #

Calculates the erfc of value


[View source]
def erfc(value : Float64) #

Calculates the erfc of value


[View source]
def erfc(value : Float32) #

Calculates the erfc of value


[View source]
def exp(value : Float32) #

Calculates the exp of value


[View source]
def exp(value : Float64) #

Calculates the exp of value


[View source]
def exp(value) #

Calculates the exp of value


[View source]
def exp2(value) #

Calculates the exp2 of value


[View source]
def exp2(value : Float64) #

Calculates the exp2 of value


[View source]
def exp2(value : Float32) #

Calculates the exp2 of value


[View source]
def expm1(value : Float32) #

Calculates the expm1 of value


[View source]
def expm1(value : Float64) #

Calculates the expm1 of value


[View source]
def expm1(value) #

Calculates the expm1 of value


[View source]
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.


[View source]
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.


[View source]
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.


[View source]
def hypot(value1 : Float64, value2 : Float64) #

Calculates hypot with parameters value1 and value2


[View source]
def hypot(value1, value2) #

Calculates hypot with parameters value1 and value2


[View source]
def hypot(value1 : Float32, value2 : Float32) #

Calculates hypot with parameters value1 and value2


[View source]
def ilogb(value) #

Calculates the ilogb of value


[View source]
def ilogb(value : Float64) #

Calculates the ilogb of value


[View source]
def ilogb(value : Float32) #

Calculates the ilogb of value


[View source]
def ldexp(value1, value2) #

Calculates ldexp with parameters value1 and value2


[View source]
def ldexp(value1 : Float64, value2 : Int32) #

Calculates ldexp with parameters value1 and value2


[View source]
def ldexp(value1 : Float32, value2 : Int32) #

Calculates ldexp with parameters value1 and value2


[View source]
def lgamma(value : Float32) #

Calculates the logarithmic gamma of value.

lgamma(x) is the same as

Math.log(Math.gamma(x).abs)

[View source]
def lgamma(value : Float64) #

Calculates the logarithmic gamma of value.

lgamma(x) is the same as

Math.log(Math.gamma(x).abs)

[View source]
def lgamma(value) #

Calculates the logarithmic gamma of value.

lgamma(x) is the same as

Math.log(Math.gamma(x).abs)

[View source]
def log(value : Float64) #

Calculates the log of value


[View source]
def log(value) #

Calculates the log of value


[View source]
def log(numeric, base) #

To be uncommented once LLVM is updated

def div(value1 : Int32, value2 : Int32) LibM.div_i32(value1, value2) end

def div(value1 : Float32, value2 : Float32) LibM.div_f32(value1, value2) end

def div(value1 : Float64, value2 : Float64) LibM.div_f64(value1, value2) end

def div(value1, value2) LibM.div(value1, value2) end Returns the logarithm of numeric to the base base


[View source]
def log(value : Float32) #

Calculates the log of value


[View source]
def log10(value : Float64) #

Calculates the log10 of value


[View source]
def log10(value : Float32) #

Calculates the log10 of value


[View source]
def log10(value) #

Calculates the log10 of value


[View source]
def log1p(value) #

Calculates the log1p of value


[View source]
def log1p(value : Float64) #

Calculates the log1p of value


[View source]
def log1p(value : Float32) #

Calculates the log1p of value


[View source]
def log2(value) #

Calculates the log2 of value


[View source]
def log2(value : Float64) #

Calculates the log2 of value


[View source]
def log2(value : Float32) #

Calculates the log2 of value


[View source]
def logb(value : Float32) #

Calculates the logb of value


[View source]
def logb(value : Float64) #

Calculates the logb of value


[View source]
def logb(value) #

Calculates the logb of value


[View source]
def max(value1, value2) #

Returns the greater of value1 and value2.


[View source]
def min(value1, value2) #

Returns the smaller of value1 and value2.


[View source]
def pw2ceil(v) #

Computes the next highest power of 2 of v

Math.pw2ceil(33) #=> 64

[View source]
def scalbln(value, exp) #

Multiplies value by 2 raised to power exp.


[View source]
def scalbln(value : Float32, exp : Int64) #

Multiplies value by 2 raised to power exp.


[View source]
def scalbln(value : Float64, exp : Int64) #

Multiplies value by 2 raised to power exp.


[View source]
def scalbn(value1, value2) #

Calculates scalbn with parameters value1 and value2


[View source]
def scalbn(value1 : Float64, value2 : Int32) #

Calculates scalbn with parameters value1 and value2


[View source]
def scalbn(value1 : Float32, value2 : Int32) #

Calculates scalbn with parameters value1 and value2


[View source]
def sin(value) #

Calculates the sin of value


[View source]
def sin(value : Float64) #

Calculates the sin of value


[View source]
def sin(value : Float32) #

Calculates the sin of value


[View source]
def sinh(value) #

Calculates the sinh of value


[View source]
def sinh(value : Float64) #

Calculates the sinh of value


[View source]
def sinh(value : Float32) #

Calculates the sinh of value


[View source]
def sqrt(value) #

Calculates the sqrt of value


[View source]
def sqrt(value : Float64) #

Calculates the sqrt of value


[View source]
def sqrt(value : Float32) #

Calculates the sqrt of value


[View source]
def tan(value) #

Calculates the tan of value


[View source]
def tan(value : Float64) #

Calculates the tan of value


[View source]
def tan(value : Float32) #

Calculates the tan of value


[View source]
def tanh(value) #

Calculates the tanh of value


[View source]
def tanh(value : Float64) #

Calculates the tanh of value


[View source]
def tanh(value : Float32) #

Calculates the tanh of value


[View source]