Always false float comparisons

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu May 12 08:55:52 PDT 2016


On 5/12/2016 3:30 AM, Manu via Digitalmars-d wrote:
> But they can easily be helped by implementing behaviour that makes sense.

One thing that's immutably true about computer floating point is that it does 
not make intuitive sense if your intuition is based on mathematics. It's a 
hopeless cause trying to bash it into 'making sense'. It's something one has to 
simply take the time and learn.

This reminds me of all the discussions around trying to hide the fact that D 
strings are UTF-8 code units. The ultimate outcome of trying to make it "make 
sense" was the utter disaster of autodecoding.


> If you're set on a warning, at least make the warning recommend
> down-casting the higher precision term to the lower precision?

Yes, of course. I believe error messages should suggest corrective action.



More information about the Digitalmars-d mailing list