Module: Math
- Defined in:
- lib/source/ruby.rb
Overview
The Math module contains module functions for basic trigonometric and transcendental functions.
Constant Summary collapse
- E =
2.71828182845904523536- PI =
3.14159265358979323846
Class Method Summary collapse
-
.acos(x) ⇒ Object
call-seq: Math.acos(x) -> numeric.
-
.acosh(x) ⇒ Object
call-seq: Math.acosh(x) -> numeric.
-
.asin(x) ⇒ Object
call-seq: Math.asin(x) -> numeric.
-
.asinh(x) ⇒ Object
call-seq: Math.asinh(x) -> numeric.
-
.atan(x) ⇒ Object
call-seq: Math.atan(x) -> numeric.
-
.atan2(y, x) ⇒ Object
call-seq: Math.atan2(y,x) -> numeric.
-
.atanh(x) ⇒ Object
call-seq: Math.atanh(x) -> numeric.
-
.cos(x) ⇒ Object
call-seq: Math.cos(x) -> numeric.
-
.cosh(x) ⇒ Object
call-seq: Math.cosh(x) -> numeric.
-
.erf(x) ⇒ Object
call-seq: Math.erf(x) -> numeric.
-
.erfc(x) ⇒ Object
call-seq: Math.erfc(x) -> numeric.
-
.exp(x) ⇒ Object
call-seq: Math.exp(x) -> numeric.
-
.frexp(numeric) ⇒ Object
call-seq: Math.frexp(x) -> [fraction, exponent].
-
.hypot(x, y) ⇒ Object
call-seq: Math.hypot(x,y) -> numeric.
-
.ldexp(flt, int) ⇒ Object
call-seq: Math.ldexp(flt,int) -> numeric.
-
.log(x) ⇒ Object
call-seq: Math.log(x) -> numeric.
-
.log10(x) ⇒ Object
call-seq: Math.log10(x) -> numeric.
-
.sin(x) ⇒ Object
call-seq: Math.sin(x) -> numeric.
-
.sinh(x) ⇒ Object
call-seq: Math.sinh(x) -> numeric.
-
.sqrt(x) ⇒ Object
call-seq: Math.sqrt(x) -> numeric.
-
.tan(x) ⇒ Object
call-seq: Math.tan(x) -> numeric.
-
.tanh(x) ⇒ Object
call-seq: Math.tanh(x) -> numeric.
Class Method Details
.acos(x) ⇒ Object
call-seq:
Math.acos(x) -> numeric
Computes the arc cosine of x and returns its value in the range 0..PI.
1517 1518 1519 |
# File 'lib/source/ruby.rb', line 1517 def self.acos(x) `Math.acos(x)` end |
.acosh(x) ⇒ Object
call-seq:
Math.acosh(x) -> numeric
FIX: Incomplete
1525 1526 |
# File 'lib/source/ruby.rb', line 1525 def self.acosh(x) end |
.asin(x) ⇒ Object
call-seq:
Math.asin(x) -> numeric
Computes the arc sine of x and returns its value in the range -PI/2..PI/2.
1534 1535 1536 |
# File 'lib/source/ruby.rb', line 1534 def self.asin(x) `Math.asin(x)` end |
.asinh(x) ⇒ Object
call-seq:
Math.asinh(x) -> numeric
FIX: Incomplete
1542 1543 |
# File 'lib/source/ruby.rb', line 1542 def self.asinh(x) end |
.atan(x) ⇒ Object
call-seq:
Math.atan(x) -> numeric
Computes the arc tangent of x and returns its value in the range -PI/2..PI/2.
1551 1552 1553 |
# File 'lib/source/ruby.rb', line 1551 def self.atan(x) `Math.atan(x)` end |
.atan2(y, x) ⇒ Object
call-seq:
Math.atan2(y,x) -> numeric
Computes the arc tangent of y/x and returns its value in the range -PI..PI. The signs of x and y determine the quadrant of the result.
1562 1563 1564 |
# File 'lib/source/ruby.rb', line 1562 def self.atan2(y,x) `Math.atan2(y,x)` end |
.atanh(x) ⇒ Object
call-seq:
Math.atanh(x) -> numeric
FIX: Incomplete
1570 1571 |
# File 'lib/source/ruby.rb', line 1570 def self.atanh(x) end |
.cos(x) ⇒ Object
call-seq:
Math.cos(x) -> numeric
Computes the cosine of x (in radians) and returns its value in the range -1..1.
1579 1580 1581 |
# File 'lib/source/ruby.rb', line 1579 def self.cos(x) `Math.cos(x)` end |
.cosh(x) ⇒ Object
call-seq:
Math.cosh(x) -> numeric
FIX: Incomplete
1587 1588 |
# File 'lib/source/ruby.rb', line 1587 def self.cosh(x) end |
.erf(x) ⇒ Object
call-seq:
Math.erf(x) -> numeric
FIX: Incomplete
1594 1595 |
# File 'lib/source/ruby.rb', line 1594 def self.erf(x) end |
.erfc(x) ⇒ Object
call-seq:
Math.erfc(x) -> numeric
FIX: Incomplete
1601 1602 |
# File 'lib/source/ruby.rb', line 1601 def self.erfc(x) end |
.exp(x) ⇒ Object
call-seq:
Math.exp(x) -> numeric
Returns e**(x).
1609 1610 1611 |
# File 'lib/source/ruby.rb', line 1609 def self.exp(x) `Math.exp(x)` end |
.frexp(numeric) ⇒ Object
call-seq:
Math.frexp(x) -> [fraction, exponent]
FIX: Incomplete
1617 1618 |
# File 'lib/source/ruby.rb', line 1617 def self.frexp(numeric) end |
.hypot(x, y) ⇒ Object
call-seq:
Math.hypot(x,y) -> numeric
FIX: Incomplete
1624 1625 |
# File 'lib/source/ruby.rb', line 1624 def self.hypot(x,y) end |
.ldexp(flt, int) ⇒ Object
call-seq:
Math.ldexp(flt,int) -> numeric
FIX: Incomplete
1631 1632 |
# File 'lib/source/ruby.rb', line 1631 def self.ldexp(flt,int) end |
.log(x) ⇒ Object
call-seq:
Math.log(x) -> numeric
Returns the natural logarithm of x.
1639 1640 1641 1642 |
# File 'lib/source/ruby.rb', line 1639 def self.log(x) `if(x==0){return -Infinity;}` `Math.log(x)` end |
.log10(x) ⇒ Object
call-seq:
Math.log10(x) -> numeric
Returns the base 10 logarithm of x.
1649 1650 1651 1652 |
# File 'lib/source/ruby.rb', line 1649 def self.log10(x) `if(x==0){return -Infinity;}` `Math.log(x)/Math.log(10)` end |
.sin(x) ⇒ Object
call-seq:
Math.sin(x) -> numeric
Computes the sine of x (in radians) and returns its value in the range -1..1.
1660 1661 1662 |
# File 'lib/source/ruby.rb', line 1660 def self.sin(x) `Math.sin(x)` end |
.sinh(x) ⇒ Object
call-seq:
Math.sinh(x) -> numeric
FIX: Incomplete
1668 1669 |
# File 'lib/source/ruby.rb', line 1668 def self.sinh(x) end |
.sqrt(x) ⇒ Object
call-seq:
Math.sqrt(x) -> numeric
Returns the non-negative square root of x.
1676 1677 1678 |
# File 'lib/source/ruby.rb', line 1676 def self.sqrt(x) `Math.sqrt(x)` end |