[Python-Dev] HUGE_VAL and INFINITY

Jack Jansen Jack.Jansen@cwi.nl
Tue, 2 Jul 2002 16:28:49 +0200


I think there is a problem with the way pyport.h treats HUGE_VAL and 
INFINITY. But as this whole area is a great can of worms I'd like 
someone with more knowledge of C standards and floating point and such 
to ponder it, please.

If both INFINITY and HUGE_VAL are defined then INFINITY takes 
precedence. However, all references I've seen to INFINITY seem to 
indicate that this is a float value, not a double value, according to 
the C99 standard. And I've now come across a platform where 
HUGE_VAL==1e500 and INFINITY==HUGE_VALF==1e50, and these latter values 
are not infinite for doubles (I assume they are infinite for floats, but 
I haven't checked).

I have a patch that will fix this problem for my specific case, but I 
have the feeling that it may be the pyport.h logic that is at fault 
here. If no-one jumps in I'll commit my fix in a few days time.
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -