Website hosting service by Active-Venture.com
 

 Back to Index

prev - up - next - index

Math

The modules for the floating point arithmetic. The Math module has methods and modules methods of the same definitions in same names.

Example:

pi = Math.atan2(1, 1)*4;
include Math
pi2 = atan2(1, 1)*4

Module Functions:

atan2(y, x)

Returns the arc tangent of the two variable x and y in radian, which is between -PI and PI.

cos(x)
sin(x)
tan(x)

Returns the cosine, sine, tangent, respectively, of x, where x is given in radians, which is between -1 and 1.

exp(x)

Returns the value of e raised to the power of x.

frexp(x)

Returns the nomalized fraction and an the exponent.

ldexp(x,exp)

Returns the result of multiplying the floating-point number x by 2 raised to the power of exp.

log(x)

Returns the natural logarithm of x.

log10(x)

Returns the base-10 logarithm of x.

sqrt(x)

Returns non-negative square root of x. It raises an exception, if x is negative.

Constants:

PI

The pi.

E

The e.


prev - up - next - index

matz@netlab.co.jp

 

  

 

 

2002-2004 Active-Venture.com Website Hosting Service

 
Buy domain name at only $5.95/yr with comprehensive domain hosting services. Domain registration and domain search service from $5.95 Cheap domain name registration and domain transfer service
 

Disclaimer: This documentation is provided only for the benefits of our website hosting customers.
For authoritative source of the documentation, please refer to http://www.ruby-doc.org/docs/