Module Math
In: math.c
lib/complex.rb

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.

Methods

acos   acos   acos!   acosh   acosh   acosh!   asin   asin   asin!   asinh   asinh   asinh!   atan   atan   atan!   atan2   atan2   atan2!   atanh   atanh   atanh!   cos   cos   cos!   cosh   cosh   cosh!   erf   erfc   exp   exp   exp!   frexp   hypot   ldexp   log   log   log!   log10   log10   log10!   sin   sin   sin!   sinh   sinh   sinh!   sqrt   sqrt   sqrt!   tan   tan   tan!   tanh   tanh   tanh!  

Constants

PI = rb_float_new(M_PI)
PI = rb_float_new(atan(1.0)*4.0)
E = rb_float_new(M_E)
E = rb_float_new(exp(1.0))

Public Instance methods

Computes the arc cosine of x. Returns 0..PI.

acos!(p1)

Alias for acos

Computes the inverse hyperbolic cosine of x.

acosh!(p1)

Alias for acosh

Computes the arc sine of x. Returns 0..PI.

asin!(p1)

Alias for asin

Computes the inverse hyperbolic sine of x.

asinh!(p1)

Alias for asinh

Computes the arc tangent of x. Returns -{PI/2} .. {PI/2}.

atan!(p1)

Alias for atan

Computes the arc tangent given y and x. Returns -PI..PI.

atan2!(p1, p2)

Alias for atan2

Computes the inverse hyperbolic tangent of x.

atanh!(p1)

Alias for atanh

Computes the cosine of x (expressed in radians). Returns -1..1.

Redefined to handle a Complex argument.

cos!(p1)

Alias for cos

Computes the hyperbolic cosine of x (expressed in radians).

cosh!(p1)

Alias for cosh

Calculates the error function of x.

Calculates the complementary error function of x.

Redefined to handle a Complex argument.

exp!(p1)

Alias for exp

Returns a two-element array containing the normalized fraction (a Float) and exponent (a Fixnum) of numeric.

   fraction, exponent = Math.frexp(1234)   #=> [0.6025390625, 11]
   fraction * 2**exponent                  #=> 1234.0

Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle with sides x and y.

   Math.hypot(3, 4)   #=> 5.0

Returns the value of flt*(2**int).

   fraction, exponent = Math.frexp(1234)
   Math.ldexp(fraction, exponent)   #=> 1234.0

Redefined to handle a Complex argument.

Returns the natural logarithm of numeric.

log!(p1)

Alias for log

Redefined to handle a Complex argument.

Returns the base 10 logarithm of numeric.

log10!(p1)

Alias for log10

Computes the sine of x (expressed in radians). Returns -1..1.

Redefined to handle a Complex argument.

sin!(p1)

Alias for sin

Computes the hyperbolic sine of x (expressed in radians).

sinh!(p1)

Alias for sinh

Redefined to handle a Complex argument.

Returns the non-negative square root of numeric. Raises ArgError if numeric is less than zero.

sqrt!(p1)

Alias for sqrt

Returns the tangent of x (expressed in radians).

Redefined to handle a Complex argument.

tan!(p1)

Alias for tan

Computes the hyperbolic tangent of x (expressed in radians).

tanh!(p1)

Alias for tanh

To view or add comments on this documentation, please go to the API wiki.

[Validate]