W3cubDocs

/Crystal 0.31

module Math

Extended Modules

Defined in:

math/math.cr
big/big_int.cr
big/big_float.cr
big/big_rational.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 : Float32)Source

Calculates the acos of value.

def acos(value : Float64)Source

Calculates the acos of value.

def acos(value)Source

Calculates the acos of value.

def acosh(value : Float32)Source

Calculates the acosh of value.

def acosh(value : Float64)Source

Calculates the acosh of value.

def acosh(value)Source

Calculates the acosh of value.

def asin(value : Float32)Source

Calculates the asin of value.

def asin(value : Float64)Source

Calculates the asin of value.

def asin(value)Source

Calculates the asin of value.

def asinh(value : Float32)Source

Calculates the asinh of value.

def asinh(value : Float64)Source

Calculates the asinh of value.

def asinh(value)Source

Calculates the asinh of value.

def atan(value)Source

Calculates the atan of value.

def atan(value : Float64)Source

Calculates the atan of value.

def atan(value : Float32)Source

Calculates the atan of value.

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

Calculates atan2 with parameters value1 and value2.

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

Calculates atan2 with parameters value1 and value2.

def atan2(value1, value2)Source

Calculates atan2 with parameters value1 and value2.

def atanh(value : Float32)Source

Calculates the atanh of value.

def atanh(value : Float64)Source

Calculates the atanh of value.

def atanh(value)Source

Calculates the atanh of value.

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

Calculates besselj with parameters value1 and value2.

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

Calculates besselj with parameters value1 and value2.

def besselj(value1, value2)Source

Calculates besselj with parameters value1 and value2.

def besselj0(value)Source

Calculates the besselj0 function of value.

def besselj0(value : Float64)Source

Calculates the besselj0 function of value.

def besselj0(value : Float32)Source

Calculates the besselj0 function of value.

def besselj1(value)Source

Calculates the besselj1 function of value.

def besselj1(value : Float64)Source

Calculates the besselj1 function of value.

def besselj1(value : Float32)Source

Calculates the besselj1 function of value.

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

Calculates bessely with parameters value1 and value2.

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

Calculates bessely with parameters value1 and value2.

def bessely(value1, value2)Source

Calculates bessely with parameters value1 and value2.

def bessely0(value : Float64)Source

Calculates the bessely0 function of value.

def bessely0(value)Source

Calculates the bessely0 function of value.

def bessely0(value : Float32)Source

Calculates the bessely0 function of value.

def bessely1(value)Source

Calculates the bessely1 function of value.

def bessely1(value : Float64)Source

Calculates the bessely1 function of value.

def bessely1(value : Float32)Source

Calculates the bessely1 function of value.

def cbrt(value)Source

Calculates the cbrt of value.

def cbrt(value : Float64)Source

Calculates the cbrt of value.

def cbrt(value : Float32)Source

Calculates the cbrt of value.

def copysign(value1, value2)Source

Calculates copysign with parameters value1 and value2.

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

Calculates copysign with parameters value1 and value2.

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

Calculates copysign with parameters value1 and value2.

def cos(value : Float64)Source

Calculates the cos of value.

def cos(value : Float32)Source

Calculates the cos of value.

def cos(value)Source

Calculates the cos of value.

def cosh(value : Float32)Source

Calculates the cosh of value.

def cosh(value : Float64)Source

Calculates the cosh of value.

def cosh(value)Source

Calculates the cosh of value.

def erf(value : Float32)Source

Calculates the erf of value.

def erf(value : Float64)Source

Calculates the erf of value.

def erf(value)Source

Calculates the erf of value.

def erfc(value : Float32)Source

Calculates the erfc of value.

def erfc(value : Float64)Source

Calculates the erfc of value.

def erfc(value)Source

Calculates the erfc of value.

def exp(value : Float32)Source

Calculates the exp of value.

def exp(value : Float64)Source

Calculates the exp of value.

def exp(value)Source

Calculates the exp of value.

def exp2(value : Float64)Source

Calculates the exp2 of value.

def exp2(value)Source

Calculates the exp2 of value.

def exp2(value : Float32)Source

Calculates the exp2 of value.

def expm1(value : Float32)Source

Calculates the expm1 of value.

def expm1(value : Float64)Source

Calculates the expm1 of value.

def expm1(value)Source

Calculates the expm1 of value.

def frexp(value)Source

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

def frexp(value : BigFloat)Source

def frexp(value : Float64)Source

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

def frexp(value : Float32)Source

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

def gamma(value : Float64)Source

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)Source

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)Source

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)Source

Calculates hypot with parameters value1 and value2.

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

Calculates hypot with parameters value1 and value2.

def hypot(value1, value2)Source

Calculates hypot with parameters value1 and value2.

def ilogb(value : Float32)Source

Calculates the ilogb of value.

def ilogb(value : Float64)Source

Calculates the ilogb of value.

def ilogb(value)Source

Calculates the ilogb of value.

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

Calculates ldexp with parameters value1 and value2.

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

Calculates ldexp with parameters value1 and value2.

def ldexp(value1, value2)Source

Calculates ldexp with parameters value1 and value2.

def lgamma(value)Source

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)Source

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)Source

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)Source

Returns the logarithm of numeric to the base base.

def log(value : Float64)Source

Calculates the log of value.

def log(value)Source

Calculates the log of value.

def log(value : Float32)Source

Calculates the log of value.

def log10(value : Float32)Source

Calculates the log10 of value.

def log10(value)Source

Calculates the log10 of value.

def log10(value : Float64)Source

Calculates the log10 of value.

def log1p(value)Source

Calculates the log1p of value.

def log1p(value : Float64)Source

Calculates the log1p of value.

def log1p(value : Float32)Source

Calculates the log1p of value.

def log2(value)Source

Calculates the log2 of value.

def log2(value : Float64)Source

Calculates the log2 of value.

def log2(value : Float32)Source

Calculates the log2 of value.

def logb(value)Source

Calculates the logb of value.

def logb(value : Float64)Source

Calculates the logb of value.

def logb(value : Float32)Source

Calculates the logb of value.

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

def max(value1, value2)Source

Returns the greater of value1 and value2.

def max(value1 : Float32, value2 : Float32)Source

def min(value1 : Float32, value2 : Float32)Source

def min(value1 : Float64, value2 : Float64)Source

def min(value1, value2)Source

Returns the smaller of value1 and value2.

def pw2ceil(v)Source

Computes the next highest power of 2 of v.

Math.pw2ceil(33) # => 64

def scalbln(value, exp)Source

Multiplies value by 2 raised to power exp.

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

Multiplies value by 2 raised to power exp.

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

Multiplies value by 2 raised to power exp.

def scalbn(value1, value2)Source

Calculates scalbn with parameters value1 and value2.

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

Calculates scalbn with parameters value1 and value2.

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

Calculates scalbn with parameters value1 and value2.

def sin(value : Float32)Source

Calculates the sin of value.

def sin(value : Float64)Source

Calculates the sin of value.

def sin(value)Source

Calculates the sin of value.

def sinh(value : Float32)Source

Calculates the sinh of value.

def sinh(value : Float64)Source

Calculates the sinh of value.

def sinh(value)Source

Calculates the sinh of value.

def sqrt(value : Float32)Source

Calculates the sqrt of value.

def sqrt(value : Float64)Source

Calculates the sqrt of value.

def sqrt(value : BigInt)Source

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)Source

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)Source

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)Source

Calculates the sqrt of value.

def tan(value : Float32)Source

Calculates the tan of value.

def tan(value : Float64)Source

Calculates the tan of value.

def tan(value)Source

Calculates the tan of value.

def tanh(value : Float32)Source

Calculates the tanh of value.

def tanh(value : Float64)Source

Calculates the tanh of value.

def tanh(value)Source

Calculates the tanh of value.

© 2012–2019 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.31.1/Math.html