Type:
Module
Constants:
PI : DBL2NUM(M_PI)
E : DBL2NUM(M_E)

When mathn is required, the Math module changes as follows:

Standard Math module behaviour:

Math.sqrt(4/9)     # => 0.0
Math.sqrt(4.0/9.0) # => 0.666666666666667
Math.sqrt(- 4/9)   # => Errno::EDOM: Numerical argument out of domain - sqrt

After require 'mathn', this is changed to:

require 'mathn'
Math.sqrt(4/9)      # => 2/3
Math.sqrt(4.0/9.0)  # => 0.666666666666667
Math.sqrt(- 4/9)    # => Complex(0, 2/3)

The Math module contains module functions for basic trigonometric and transcendental functions. See class Float for a list of constants that define Ruby's floating point accuracy.

log2

Math.log2(numeric) â float Class Public methods Returns the base 2 logarithm

2015-04-18 02:25:55
asinh

Math.asinh(x) â float Class Public methods Computes the inverse hyperbolic

2015-04-18 01:16:44
acos

Math.acos(x) â float Class Public methods Computes the arc cosine of x

2015-04-18 01:05:17
atan2

Math.atan2(y, x) â float Class Public methods Computes the arc tangent given

2015-04-18 01:27:47
log

Math.log(numeric) â floatMath.log(num,base) â float Class Public methods Returns

2015-04-18 02:21:04
ldexp

Math.ldexp(flt, int) â float Class Public methods Returns the value of

2015-04-18 02:09:12
frexp

Math.frexp(numeric) â [ fraction, exponent ] Class Public methods Returns

2015-04-18 01:59:53
atan

Math.atan(x) â float Class Public methods Computes the arc tangent of x

2015-04-18 01:21:27
acosh

Math.acosh(x) â float Class Public methods Computes the inverse hyperbolic

2015-04-18 01:10:26
cosh

Math.cosh(x) â float Class Public methods Computes the hyperbolic cosine

2015-04-18 01:41:04