lib/dydx/algebra/operator/parts/general.rb in dydx-0.0.4 vs lib/dydx/algebra/operator/parts/general.rb in dydx-0.0.5
- old
+ new
@@ -4,37 +4,23 @@
module Parts
module General
def +(x)
if x.is_0?
self
+ elsif inverse?(x, :+)
+ e0
else
super(x)
end
end
- def -(x)
- if x.is_0?
- self
- else
- super(x)
- end
- end
-
def *(x)
if x.is_0?
x
elsif x.is_1?
self
- else
- super(x)
- end
- end
-
- def /(x)
- if x.is_0?
- raise ZeroDivisionError
- elsif x.is_1?
- self
+ elsif inverse?(x, :*)
+ e1
else
super(x)
end
end