News for hackers. Stuff that matters.
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by sebzim4500 on Tuesday May 09, 2023 @08:12PM (#35882031)
I don't think it's just that.

1/0 is infinity but 1/(-0) is -infinity

Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by distortedsignal on Tuesday May 09, 2023 @10:00PM (#35882739)
Shouldn't both of those be NaN? Does Erlang have a NaN?
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by lolcatuser on Tuesday May 09, 2023 @10:32PM (#35882972)
The reason division by zero can be a number is that floating-point numbers aren't individual numbers but ranges of numbers. So 0.0 isn't really the integer 0, it is the range of numbers between 0 and the smallest representable non-zero number. So division by 0.0 may be division by zero, or it may be division by a very small number, in which case it would approach infinity.

The same goes for the floating-point infinity: it doesn't represent the concept of infinity, it is a placeholder for every number between the largest representable number and infinity. That's how dividing a very large number by a very small number can result in infinity, a number which is really not a number.

This is the philosophy by which IEEE floating-point numbers were designed, and it's the explanation behind which negative zeroes and infinities make sense in floating point.

The way I find it easiest to reason about is by taking a graph of an asymptote and rounding it to the nearest units. You somehow need a way to say "there is an asymptote here!" even though you might not have all the units, and so you introduce infinities and negative zeroes to maintain as much precision as possible.

Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by adgjlsfhk1 on Wednesday May 10, 2023 @01:06AM (#35883843)
this isn't true. floats don't have semantics of internals. they have semantics of exact points that do math with rounding (otherwise the result of subtracting 2 floats would sometimes be more than 1 float)
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by throwawaymaths on Wednesday May 10, 2023 @01:27AM (#35883965)
Moreover the spec defines rounding modes (rtnz, rtg, rtfz rtl) that are designed to exactly do interval arithmetic
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by franknord23 on Tuesday May 09, 2023 @10:03PM (#35882758)
IIRC division by zero throws an exception.
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by xxs on Wednesday May 10, 2023 @02:47AM (#35884414)
>both of those be NaN

Totally NOT. NaN is defined as 0.0/0.0. That's it.

Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by arcticbull on Wednesday May 10, 2023 @03:12AM (#35884596)
IEEE754 has a separate +Infinity and -Infinity to go along with SNaN and QNaN.

For instance:

- as parent said 1/0 is Inf.

- as parent said 1/(-0) and log(0) is -Inf.

- sqrt(-1) and 0/0 is NaN.

[1] https://www.gnu.org/software/libc/manual/html_node/Infinity-...

Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by fijiaarone on Tuesday May 09, 2023 @10:44PM (#35883048)
There is no negative zero
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by princeb on Tuesday May 09, 2023 @11:48PM (#35883431)
1/0 is undefined and 1/-0 is also undefined.

what we have is lim(x->0+) 1/x = +inf and lim(x->0-) 1/x = -inf

Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by adgjlsfhk1 on Wednesday May 10, 2023 @01:04AM (#35883829)
this is wrong. ieee defines them
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by kragen on Wednesday May 10, 2023 @01:05AM (#35883832)
not in ieee-754, only in reality
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by bawolff on Wednesday May 10, 2023 @06:24AM (#35885610)
Numbers are abstract concepts in general. There is no fundamental reality only "real" numbers.
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by kragen on Wednesday May 10, 2023 @12:19PM (#35889551)
the question of whether mathematical objects like 53 are more or less real than the historically contingent universe is indeed very interesting

however, it is irrelevant to the fact that a commenter was disagreeing because they had confused ieee-754 division with the division operation on so-called 'real' numbers

Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by rpaddock on Wednesday May 10, 2023 @08:32AM (#35886417)
Rigorously division by zero is "undefined" in mathematics.
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by pvillano on Wednesday May 10, 2023 @10:20AM (#35887769)
You can totally define division by zero.

"There are mathematical structures in which [dividing by zero] is defined. [...] However, such structures do not satisfy every ordinary rule of arithmetic (the field axioms)." https://wikipedia.org/wiki/Division_by_zero

You're familiar with the ordinary rules of arithmetic (ORA!) applied to the real numbers. However, there are many number systems that follow different rules.

The rules of arithmetic for floats, wraparound ints, elliptic curves, and asymptotic analysis are all different from ORA! (and each other) but they are useful in their own ways.