Module: BigMath
- Defined in:
- lib/ext/big_math.rb
Constant Summary collapse
- N_ONE =
-1.to_d
- ZERO =
0.to_d
- ONE =
1.to_d
- TWO =
2.to_d
Class Method Summary collapse
Class Method Details
.atan2(y, x, precision) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ext/big_math.rb', line 10 def self.atan2 y, x, precision case when x > ZERO BigMath.atan((y / x), precision) when y >= ZERO && x < ZERO BigMath.atan((y / x), precision) + Terraformer::PI when y < ZERO && x < ZERO BigMath.atan((y / x), precision) - Terraformer::PI when x == ZERO case when y > ZERO Terraformer::PI / TWO when y < ZERO -(Terraformer::PI / TWO) when y == ZERO BigDecimal::NAN end end end |
.tan(theta, precision) ⇒ Object
32 33 34 |
# File 'lib/ext/big_math.rb', line 32 def self.tan theta, precision BigMath.sin(theta, precision) / BigMath.cos(theta, precision) end |