not-a-number's

Mischa Baars mjbaars1977@gmail.com
Thu Jan 17 16:18:00 GMT 2013


On 01/17/2013 04:46 PM, Vincent Lefevre wrote:
> On 2013-01-17 16:33:56 +0100, Mischa Baars wrote:
>> Actually it is the correct way, as long as you stick to the
>> conventions. A QNaN is not supposed to change into anything, also
>> not with the pow(). Only the other way around. Normal numbers can
>> change into QNaN's.
> The C standard specified pow(NaN,0) = 1, pow(1,NaN) = 1, and
> hypot(inf,NaN) = +inf. You may consider that these are bad choices
> (I don't like them much either), but this is how these cases have
> been specified. You are free to write wrappers for your own programs
> and never call pow and hypot directly...
>

Again, personally I think that might just be not the smartest choice. 
QNaN are only useful when normal numbers can be changed into QNaN's but 
not the other way around. Then you can see at the end of any calculation 
if something went wrong or if it gave you the answer you had expected.



More information about the Gcc mailing list