On Sun, Apr 5, 2009 at 15:23, Brent Roman <brent / mbari.org> wrote:
> Python, however, does output 2.3999...

Actually, as I explained earlier, Python has str() (parallel to Ruby's
#to_s) and repr() (similar to Ruby's #inspect). str(2.4) returns
'2.4', repr(2.4) returns '2.3999...'. What you're seeing is probably
that you're just typing something on the interactive interpreter; like
irb, it shows the result using repr/inspect. You should type "print
2.4" to see the str() behavior.

> A good compromise solution, in Ruby's case, would be to redefine
> Float#inspect such that it preserves the value's full precision without
> rounding (for round-tripping, ultimate "truth", or whatever), while leaving
> Float#to_s as it was.

Yes, that's what Python does, and what I've been proposing too. :)
And I fully agree with your reasoning there.

--
Daniel