Sha256: f23abeb322a08aa0e15c9efbbc1a005f9c39f64e1337bece576c5ad4002ff328
Contents?: true
Size: 1.74 KB
Versions: 15
Compression:
Stored size: 1.74 KB
Contents
# pre_ddata_extras.rb # add arithmetic operators for Float and Fixnum with Dtable class Float alias :pre_ddata_add :+ def +(a) if a.class == Dobjects::Dtable a+self else pre_ddata_add(a) end end alias :pre_ddata_sub :- def -(a) if a.class == Dobjects::Dtable a.neg+self else pre_ddata_sub(a) end end alias :pre_ddata_mult :* def *(a) if a.class == Dobjects::Dtable a*self else pre_ddata_mult(a) end end alias :pre_ddata_div :/ def /(a) if a.class == Dobjects::Dtable a.inv*self else pre_ddata_div(a) end end alias :pre_ddata_pow :** def **(a) if a.class == Dobjects::Dtable a.as_exponent_of(self) else pre_ddata_pow(a) end end end class Fixnum alias :pre_ddata_add :+ def +(a) if a.class == Dobjects::Dtable a+self else pre_ddata_add(a) end end alias :pre_ddata_sub :- def -(a) if a.class == Dobjects::Dtable a.neg+self else pre_ddata_sub(a) end end alias :pre_ddata_mult :* def *(a) if a.class == Dobjects::Dtable a*self else pre_ddata_mult(a) end end alias :pre_ddata_div :/ def /(a) if a.class == Dobjects::Dtable a.inv*self else pre_ddata_div(a) end end alias :pre_ddata_pow :** def **(a) if a.class == Dobjects::Dtable a.as_exponent_of(self) else pre_ddata_pow(a) end end end
Version data entries
15 entries across 15 versions & 1 rubygems