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.

rsqrt

rsqrt(a) Class Public methods Compute square root of a non negative number.

2015-04-18 02:28:33
asin

Math.asin(x) â float Class Public methods Computes the arc sine of x

2015-04-18 01:15:56
exp

Math.exp(x) â float Class Public methods Returns e**x.

2015-04-18 01:53:30
lgamma

Math.lgamma(x) â [float, -1 or 1] Class Public methods Calculates the logarithmic

2015-04-18 02:15:07
erfc

Math.erfc(x) â float Class Public methods Calculates the complementary error

2015-04-18 01:48:11
sqrt

sqrt(a) Class Public methods Computes the square root of a. It

2015-04-18 02:36:33
cbrt

Math.cbrt(numeric) â float Class Public methods Returns the cube root of

2015-04-18 01:32:26
log2

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

2015-04-18 02:25:55
tan

Math.tan(x) â float Class Public methods Returns the tangent of x

2015-04-18 02:39:12
log

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

2015-04-18 02:21:04