Sha256: 838483cfb03de360f7332a39df40c583e63b49c0a7b49b556d33d5b884613b8f
Contents?: true
Size: 591 Bytes
Versions: 5
Compression:
Stored size: 591 Bytes
Contents
require 'dydx/algebra/set' module Dydx module Algebra include Set class Formula; include Operator::Formula; end class Inverse; include Operator::Inverse; end # TODO: Cyclomatic complexity for inverse is too high. [7/6] 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 def -@ inverse(self, :+) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
dydx-0.2.7000001 | lib/dydx/algebra.rb |
dydx-0.2.7000000 | lib/dydx/algebra.rb |
dydx-0.1.41421 | lib/dydx/algebra.rb |
dydx-0.1.412 | lib/dydx/algebra.rb |
dydx-0.1.4 | lib/dydx/algebra.rb |