Sha256: 1020d62285a3ef7627db2f31002539bf16f67b9b99aebd914e2f56f06284b02b
Contents?: true
Size: 590 Bytes
Versions: 11
Compression:
Stored size: 590 Bytes
Contents
module Dydx module Algebra module Operator module Parts module Interface %w(+ - * / ^).map(&:to_sym).each do |operator| define_method(operator) do |x| x = ::Set::Num.new(x) if x.is_a?(Fixnum) if operator == :/ && x.is_0? raise ZeroDivisionError elsif [:-, :/].include?(operator) send(inverse_ope(operator), inverse(x, inverse_ope(operator))) else super(x) end end end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems