Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/scalaroid.rb
Overview
work around floating point numbers not being printed precisely enough
Instance Method Summary collapse
-
#orig_t_s ⇒ Object
note: can not override to_json (this is not done recursively, e.g. in a Hash, before ruby 1.9).
- #to_s ⇒ Object
Instance Method Details
#orig_t_s ⇒ Object
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_s ⇒ Object
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 |