module Dydx::Algebra
Public Instance Methods
-@()
click to toggle source
# File lib/dydx/algebra.rb, line 26 def -@ inverse(self, :+) end
inverse(x, operator)
click to toggle source
TODO: Cyclomatic complexity for inverse is too high. [7/6]
# File lib/dydx/algebra.rb, line 11 def inverse(x, operator) if x.num? x = x.to_numeric if operator == :+ _(- x) else _(Rational(1, x)) end elsif x.is_a?(Inverse) && x.operator == operator x.x else Inverse.new(x, operator) end end