Re: 0.0 / 0.0 = -NAN ?From: Herbert KleebauerNewsgroups:
Aioe.org NNTP Server
Sat, 30 Apr 2022 19:02 UTC
View all headers
On 30.04.2022 17:31, Skybuck Flying wrote:
When exception masks are all enabled to stop the processor from > throwing floating point exceptions the following calculation
produces a somewhat strange result:
0.0 / 0.0 = -nan
Why is this strange? 0/0 is undefined and therefore "Not A Number"
> Problem is with the code, example:
T := 0;
D := 0.0 / 0.0;
P := T * D;
Why should P be zero? Suppose T=x and D=x/x^2
For x=0 you get T=0, D=0/0 and you say P should be 0,
but P=T*D = x*x/x^2 = 1
> This screws up P. instead of P being zero, P is now also -NAN ?!?
"Something" multiplied with "NotANumber" is also "NotANumber" even if the
"something" is zero.