Sha256: a4e1f2e90479711aedfb364ae42fa49ed26e866b23a52cc1ffb31c5e96cb8bdd

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

module Dydx
  module Algebra
    module Set
      Fixnum.class_eval do
        include Helper

        %w(+ - * / ^).each do |operator|
          define_method(operator) do |g|
            if g.is_a?(Symbol) ||
              g.is_a?(Formula) ||
              g.is_a?(Base) ||
              %w(/ ^).include?(operator)

              _(self).send(operator.to_sym, g)
            else
              (to_f.send(operator.to_sym, g)).to_i
            end
          end
        end

        def differentiate(sym=:x)
          _(0)
        end
        alias_method :d, :differentiate
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dydx-0.0.1 lib/dydx/algebra/set/fixnum.rb