1. -Infinity / -Infinity

Okay...

I wrote a quick test program to play with infinities and not-a-numbers =
for a few minutes. My code is:

   atom A

   A =3D 1e300

   print (1, A)
   puts (1, ' ')

   A =3D 1e300 * 1e300 -- this makes A =3D infinity

   print (1, A)
   puts (1, ' ')

   A =3D 0 - A

   print (1, A)
   puts (1, ' ')

   A =3D A / A

   print (1, A)
   puts (1, ' ')

   A =3D 0 - A

   print (1, A)
   puts (1, ' ')

At "A =3D 0 - A", we have a negative infinity. I understand that. Then =
"A / A" (i.e., -inf / -inf) is computed, resulting in a negative nan. =
Um... is this *supposed* to be the case with infinities? I would have =
thought that two negatives, even infinities, would result in a positive =
number (or not-a-number). Or is my higher math education incomplete?

(In case it matters, this is version 2.0 of Euphoria... has this been =
addressed in the upgrade, assuming it's actually a problem?)


Rod Jackson

new topic     » topic index » view message » categorize

2. Re: -Infinity / -Infinity

> At "A = 0 - A", we have a negative infinity. I understand that. Then "A / A"
> (i.e., -inf / -inf) is computed, resulting in a negative nan. Um... is this
> *supposed* to be the case with infinities? I would have thought that two
> negatives, even infinities, would result in a positive number (or not-a-number).
> Or is my higher math education incomplete?

I tried it on my computer and got the same results. A/A should be 1 as long as a
isn't 0 (in which case it's undefined), and it definately shouldn't be negitive.
There isn't any reason why -infinity/-infinity should equal -(not a number).
--
Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

new topic     » goto parent     » topic index » view message » categorize

3. Re: -Infinity / -Infinity

Rod Jackson writes:
> Then "A / A" (i.e., -inf / -inf) is computed, resulting in a negative nan

I tested your example with a small C program. I got  -nan
using hardware (Pentium) floating-point. I guess you should
complain to Intel  smile

When you are dealing with nan's, does it really
matter whether you have -nan or +nan. Either way the
result is "not a number", "undefined", "doesn't exist" etc.
If it's not even a number, how can -1 * "not a number"
have any meaning?

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu