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.
1547 1548 1549 |
# File 'lib/source/ruby.rb', line 1547 def self.acos(x) `Math.acos(x)` end |
.acosh(x) ⇒ Object
call-seq:
Math.acosh(x) -> numeric
FIX: Incomplete
1555 1556 |
# File 'lib/source/ruby.rb', line 1555 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.
1564 1565 1566 |
# File 'lib/source/ruby.rb', line 1564 def self.asin(x) `Math.asin(x)` end |
.asinh(x) ⇒ Object
call-seq:
Math.asinh(x) -> numeric
FIX: Incomplete
1572 1573 |
# File 'lib/source/ruby.rb', line 1572 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.
1581 1582 1583 |
# File 'lib/source/ruby.rb', line 1581 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.
1592 1593 1594 |
# File 'lib/source/ruby.rb', line 1592 def self.atan2(y,x) `Math.atan2(y,x)` end |
.atanh(x) ⇒ Object
call-seq:
Math.atanh(x) -> numeric
FIX: Incomplete
1600 1601 |
# File 'lib/source/ruby.rb', line 1600 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.
1609 1610 1611 |
# File 'lib/source/ruby.rb', line 1609 def self.cos(x) `Math.cos(x)` end |
.cosh(x) ⇒ Object
call-seq:
Math.cosh(x) -> numeric
FIX: Incomplete
1617 1618 |
# File 'lib/source/ruby.rb', line 1617 def self.cosh(x) end |
.erf(x) ⇒ Object
call-seq:
Math.erf(x) -> numeric
FIX: Incomplete
1624 1625 |
# File 'lib/source/ruby.rb', line 1624 def self.erf(x) end |
.erfc(x) ⇒ Object
call-seq:
Math.erfc(x) -> numeric
FIX: Incomplete
1631 1632 |
# File 'lib/source/ruby.rb', line 1631 def self.erfc(x) end |
.exp(x) ⇒ Object
call-seq:
Math.exp(x) -> numeric
Returns e**(x).
1639 1640 1641 |
# File 'lib/source/ruby.rb', line 1639 def self.exp(x) `Math.exp(x)` end |
.frexp(numeric) ⇒ Object
call-seq:
Math.frexp(x) -> [fraction, exponent]
FIX: Incomplete
1647 1648 |
# File 'lib/source/ruby.rb', line 1647 def self.frexp(numeric) end |
.hypot(x, y) ⇒ Object
call-seq:
Math.hypot(x,y) -> numeric
FIX: Incomplete
1654 1655 |
# File 'lib/source/ruby.rb', line 1654 def self.hypot(x,y) end |
.ldexp(flt, int) ⇒ Object
call-seq:
Math.ldexp(flt,int) -> numeric
FIX: Incomplete
1661 1662 |
# File 'lib/source/ruby.rb', line 1661 def self.ldexp(flt,int) end |
.log(x) ⇒ Object
call-seq:
Math.log(x) -> numeric
Returns the natural logarithm of x.
1669 1670 1671 1672 |
# File 'lib/source/ruby.rb', line 1669 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.
1679 1680 1681 1682 |
# File 'lib/source/ruby.rb', line 1679 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.
1690 1691 1692 |
# File 'lib/source/ruby.rb', line 1690 def self.sin(x) `Math.sin(x)` end |
.sinh(x) ⇒ Object
call-seq:
Math.sinh(x) -> numeric
FIX: Incomplete
1698 1699 |
# File 'lib/source/ruby.rb', line 1698 def self.sinh(x) end |
.sqrt(x) ⇒ Object
call-seq:
Math.sqrt(x) -> numeric
Returns the non-negative square root of x.
1706 1707 1708 |
# File 'lib/source/ruby.rb', line 1706 def self.sqrt(x) `Math.sqrt(x)` end |