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.

atanh

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

2015-04-18 01:31:00
sinh

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

2015-04-18 02:32:41
cos

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

2015-04-18 01:36:59
log10

Math.log10(numeric) â float Class Public methods Returns the base 10 logarithm

2015-04-18 02:22:32
gamma

Math.gamma(x) â float Class Public methods Calculates the gamma function of

2015-04-18 02:04:08
hypot

Math.hypot(x, y) â float Class Public methods Returns sqrt(x**2 + y**2)

2015-04-18 02:07:42
erf

Math.erf(x) â float Class Public methods Calculates the error function of

2015-04-18 01:45:47