Sha256: 19b1358ae7dd6937959ebbf3605ae24b291a0391cb05b626d3a4934aa0b08f2e
Contents?: true
Size: 1015 Bytes
Versions: 2
Compression:
Stored size: 1015 Bytes
Contents
module Dydx module Algebra module Operator module Parts module Num def +(x) if n == 0 x elsif x.is_a?(Num) _(n + x.n) else super(x) end end def -(x) if x.is_a?(Num) _(n - x.n) else super(x) end end def *(x) if n == 0 self elsif n == 1 x elsif x.is_a?(Num) _(n * x.n) else super(x) end end def /(x) if (n == 0) self else super(x) end end def ^(x) if (n == 0) || (n == 1) self elsif x.is_a?(Num) _(n ^ x.n) else super(x) end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dydx-0.0.4 | lib/dydx/algebra/operator/parts/num.rb |
dydx-0.0.3 | lib/dydx/algebra/operator/parts/num.rb |