Module | Math |
In: |
math.c
lib/complex.rb lib/mathn.rb |
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)) |
sqrt | -> | sqrt! |
exp | -> | exp! |
log | -> | log! |
log10 | -> | log10! |
cos | -> | cos! |
sin | -> | sin! |
tan | -> | tan! |
cosh | -> | cosh! |
sinh | -> | sinh! |
tanh | -> | tanh! |
acos | -> | acos! |
asin | -> | asin! |
atan | -> | atan! |
atan2 | -> | atan2! |
acosh | -> | acosh! |
asinh | -> | asinh! |
atanh | -> | atanh! |
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
ruby-doc.org is a service of James Britt and Neurogami, a Ruby application development company in Phoenix, AZ.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.