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.

gamma

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

2015-04-18 02:04:08
erf

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

2015-04-18 01:45:47
hypot

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

2015-04-18 02:07:42
log10

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

2015-04-18 02:22:32
cos

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

2015-04-18 01:36:59
cosh

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

2015-04-18 01:41:04
atanh

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

2015-04-18 01:31:00