Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/long-decimal.rb

Instance Method Summary collapse

Instance Method Details

#*(y) ⇒ Object

fix multiplication



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/long-decimal.rb', line 165

def *(y)
  if (self == 0 || y == 0)
    return self.mul(y)
  elsif (y.kind_of? Fixnum)
    x = self
    s = 0
    while (x & 0xff == 0)
      x >>= 8
      s += 8
    end
    while (y & 0xff == 0)
      y >>= 8
      s += 8
    end
    return x.mul(y) << s
  else
    return self.mul(y)
  end
end

#mulObject



162
# File 'lib/long-decimal.rb', line 162

alias :mul :*