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.
| Public Methods |
| acos |
Computes the arc cosine of x. Returns 0..PI.
|
| acosh |
Computes the inverse hyperbolic cosine of x.
|
| asin |
Computes the arc sine of x. Returns 0..PI.
|
| asinh |
Computes the inverse hyperbolic sine of x.
|
| atan |
Computes the arc tangent of x. Returns -{PI/2} .. {PI/2}.
|
| atan2 |
Computes the arc tangent given y and x. Returns -PI..PI.
|
| atanh |
Computes the inverse hyperbolic tangent of x.
|
| cos |
Computes the cosine of x (expressed in radians). Returns -1..1.
|
| cosh |
Computes the hyperbolic cosine of x (expressed in radians).
|
| erf |
Calculates the error function of x.
|
| erfc |
Calculates the complementary error function of x.
|
| exp |
Returns e**x.
|
| frexp |
Returns a two-element array containing the normalized fraction (a
Float) and exponent (a Fixnum) of numeric.
|
| hypot |
Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle with
sides x and y.
|
| ldexp |
Returns the value of flt*(2**int).
|
| log |
Returns the natural logarithm of numeric.
|
| log10 |
Returns the base 10 logarithm of numeric.
|
| sin |
Computes the sine of x (expressed in radians). Returns -1..1.
|
| sinh |
Computes the hyperbolic sine of x (expressed in radians).
|
| sqrt |
Returns the non-negative square root of numeric.
|
| tan |
Returns the tangent of x (expressed in radians).
|
| tanh |
Computes the hyperbolic tangent of x (expressed in radians).
|
<code/>and<pre/>for code samples.