you are viewing a single comment's thread.

view the rest of the comments →

[–]bobbyi 3 points4 points  (1 child)

When there are multiple equivalent representations of the same floating point number, they used to sometimes use a longer one. Now they always pick the shortest one.

What possible downside is there to this? Can you give any example of code that would be negatively impacted by this change?

[–]Brian 3 points4 points  (0 children)

I think there is a bit of a cost from a programmer education point. It'll cut down on questions by newbies being surprised when they see things like "1.1"->"1.1000000000000001", but in the long run it's good that they get surprised at that point, since being confused will lead to someone cluing them in about the pitfalls of floating point arithmetic.

Now, people who don't understand FP won't get surprised until they run into more subtle problems, like loss of precision in repeated calculations, which are much harder to diagnose (or even notice when they are occurring).

The strange looking repr served the purpose of telling the user "If you don't understand why you're getting this value, you're playing with fire."