Class: Float

Inherits:
Object
  • Object
show all
Defined in:
lib/scalaroid.rb

Overview

work around floating point numbers not being printed precisely enough

Instance Method Summary collapse

Instance Method Details

#orig_t_sObject

note: can not override to_json (this is not done recursively, e.g. in a Hash, before ruby 1.9)



52
# File 'lib/scalaroid.rb', line 52

alias_method :orig_t_s, :to_s

#to_sObject



53
54
55
56
57
58
59
# File 'lib/scalaroid.rb', line 53

def to_s
  if not finite?
    orig_to_json(*a)
  else
    sprintf("%#.17g", self)
  end
end