News for hackers. Stuff that matters.
Re:One does not simply calculate the absolute value by croes on Sunday August 22, 2021 @04:38PM (#28269371)
So for programming convenience we ignore correct math?
Re:One does not simply calculate the absolute value by FabHK on Sunday August 22, 2021 @05:08PM (#28269627)
We cannot represent "correct math" on a computer, because the set of reals is uncountable, but in 64 bits we can only represent finitely many numbers, not infinitely many, let alone uncountably many.

And given that we have to implement some sort of approximation to the usual math on a closed subset of the reals (rationals, even), why not extend it with some "numbers" (negative zero, plus/minus infinity, NaNs) that, yes, enable programming convenience?

Re:One does not simply calculate the absolute value by croes on Sunday August 22, 2021 @05:52PM (#28270017)
There is a difference between 2.4987665678 as 2.5 and undefined as ±infinity especially because 1.0/+0.0 is +infinity and 1/0 is just an exception in Java. Shouldn't it be the same result?