Class: Float

Inherits:
Object show all
Defined in:
lib/sane/float.rb

Instance Method Summary collapse

Instance Method Details

#inspectObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/sane/float.rb', line 3

def inspect
  big = "%.20f" % self # big!
  small = "%f" % self
  
  if small.to_f == self
    small.sub!(/0+$/, '')
    small.sub(/\.$/, '.0') # reformat, see spec
  else
    big
  end
end