Hello,
I just discovered Nimrod and I'm quite impressed by many of its properties. One nice part is that integer's overflow trigger an exception (not sure why more languages don't do this: Ada did it a long time ago..), but one part which I find a bit puzzling is that float's overflow don't do the same thing by default.
I think here that it would have been more coherent to have float's overflow trigger also an exception by default..
[ Oh well at least you're more consistent than D which initialize by default integers to 0 and floats to Nan, even the author of D's manual made a mistake due to this lack of consistency.. ]
IMHO, float and integers are both "numbers" in the programmers mind: as much as possible they should behave the same..
BR, renoX
--floatChecks:on
Floats are different from integers
Sure, "What Every Computer Scientist Should Know About Floating-Point Arithmetic" is a classic, but this doesn't mean that the default behaviour of integer and float should differ too much: +/-INF, NaN are quite hard to use correctly..
And I would also add that saturation arithmetic also exist for integers, but this doesn't mean that this should be the default behaviour for integers, so why should it be different for floats?
To be honest I don't have any preference which should be the default for floats... I also don't know how much code breaks with --floatChecks:on. The compiler itself does break as system contains a definiton of Inf ...
Lets see what other people say about it.