Comparing double NAN with double INF is not IEEE compliant 
Author Message
 Comparing double NAN with double INF is not IEEE compliant

It appears as if the VC6 is not IEEE compliant for some comparisons with
NaNs and Infinity. For example the following code should always be FALSE and
it is TRUE.

#include <iostream>
#include <limits>
using namespace std;

void main()
{
 cout << " NAN == INF is "
   << (numeric_limits<double>::quiet_NaN() ==
numeric_limits<double>::infinity())
   << endl;

Quote:
}

I have not been able to find any documentation about this anywhere. Any
ideas?


Mon, 27 Sep 2004 01:28:32 GMT  
 Comparing double NAN with double INF is not IEEE compliant
This was discussed before - see this thread:

http://groups.google.com/groups?hl=en&threadm=%23CZiFwFSBHA.2132%40tkmsf
tngp05&rnum=1&prev=/groups%3Fq%3Dg:thl3317364124d%26hl%3Den%26selm%3D%25
23CZiFwFSBHA.2132%2540tkmsftngp05

The good news is that the problem is fixed in VC7.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> It appears as if the VC6 is not IEEE compliant for some comparisons
with
> NaNs and Infinity. For example the following code should always be
FALSE and
> it is TRUE.

> #include <iostream>
> #include <limits>
> using namespace std;

> void main()
> {
>  cout << " NAN == INF is "
>    << (numeric_limits<double>::quiet_NaN() ==
> numeric_limits<double>::infinity())
>    << endl;
> }

> I have not been able to find any documentation about this anywhere.
Any
> ideas?



Mon, 27 Sep 2004 02:17:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with Double.IsNan() and Double.Nan

2. result of double*double is no double

3. warning C4756: overflow in constant arithmetic in MC++ app using Double::NaN

4. IEEE-754 code to convert to and fro double/hex string

5. Assigning nan to a double

6. How to check bit patterns for IEEE float and double

7. IEEE Floating Point reader single double quad;

8. IEEE - double

9. long doubles and NaN

10. IEEE double format w/ VMS

11. Check if a float/double is NaN

12. Help, best way to compare doubles

 

 
Powered by phpBB® Forum Software