www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2013/03/06/16:07:13

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Date: Wed, 06 Mar 2013 23:06:04 +0200
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: Printing sign of NaN.
In-reply-to: <5137961A.4000505@gmx.de>
X-012-Sender: halo1 AT inter DOT net DOT il
To: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
Cc: djgpp-workers AT delorie DOT com
Message-id: <83mwug1bnn.fsf@gnu.org>
References: <51364BCD DOT 1030807 AT gmx DOT de> <83y5e11pn7 DOT fsf AT gnu DOT org> <5137961A DOT 4000505 AT gmx DOT de>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Wed, 06 Mar 2013 20:16:42 +0100
> From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
> CC: Eli Zaretskii <eliz AT gnu DOT org>
> 
>  > Isn't NaN always negative?  Do you succeed in printing both negative
>  > and positive NaN with this patch?
> 
> Yes, I can print both signs with this change.

And what about reading a signed NaN?  Does it produce a value of that
same sign when printed afterwards?

> In this line:
> 
>        if (_ldouble < 0 || (IS_NAN(ieee_value) && ieee_value.ldt.sign))
> 
> _ldouble < 0 is always false if _ldouble is a NaN.  I was not aware of this.

A NaN causes any test to fail, so _ldouble < 0 will be false and I
would also expect _ldouble > 0 to be false.  In fact, one way of
detecting a NaN is to compare it with itself and see if the result
comes out as not equal.  (You need to trick the compiler into not
being too smart, to see that, though.)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019