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
erfc

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

2015-04-18 01:48:11
cbrt

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

2015-04-18 01:32:26
sqrt

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

2015-04-18 02:36:33
lgamma

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

2015-04-18 02:15:07
tanh

Math.tanh() â float Class Public methods Computes the hyperbolic tangent

2015-04-18 02:40:01
sin

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

2015-04-18 02:31:19
tan

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

2015-04-18 02:39:12