module BigMath
Constants
- N_ONE
- ONE
- TWO
- ZERO
Public Class Methods
atan2(y, x, precision)
click to toggle source
en.wikipedia.org/wiki/Atan2#Definition_and_computation
# 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)
click to toggle source
en.wikipedia.org/wiki/Trigonometric_functions#Right-angled_triangle_definitions
# File lib/ext/big_math.rb, line 32 def self.tan theta, precision BigMath.sin(theta, precision) / BigMath.cos(theta, precision) end