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.

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
atan2

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

2015-04-18 01:27:47
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
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
frexp

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

2015-04-18 01:59:53
ldexp

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

2015-04-18 02:09:12
sinh

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

2015-04-18 02:32:41