Class: Float

Inherits:
Object
  • Object
show all
Defined in:
lib/radix.rb,
lib/radix/rational.rb

Instance Method Summary collapse

Instance Method Details

#b(base) ⇒ Object



26
27
28
# File 'lib/radix.rb', line 26

def b(base)
  Radix::Float.new(self, base)
end

#to_rObject



197
198
199
200
201
202
# File 'lib/radix/rational.rb', line 197

def to_r
  n, f = to_s.split('.')
  d = (10 * f.size).to_i
  n = (n.to_i * d) + f.to_i
  Rational(n, d) 
end