delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/03/31/15:27:57

Date: Mon, 31 Mar 2003 23:18:10 +0200
From: "Eli Zaretskii" <eliz AT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: rich AT phekda DOT freeserve DOT co DOT uk
Message-Id: <8011-Mon31Mar2003231810+0300-eliz@elta.co.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: djgpp-workers AT delorie DOT com
In-reply-to: <3E888DDF.21E2114F@phekda.freeserve.co.uk> (message from Richard
Dawe on Mon, 31 Mar 2003 19:50:07 +0100)
Subject: Re: _doprnt and NaNs
References: <3E888DDF DOT 21E2114F AT phekda DOT freeserve DOT co DOT uk>
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: Mon, 31 Mar 2003 19:50:07 +0100
> From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
> 
> The code in _doprnt (well, cvtl and isspeciall) works with floats stored in
> long doubles. When you do, say:
> 
>     printf("%f", NAN);
> 
> the NAN is first converted in _doprnt to a double by the va_arg macro, then to
> a long double.
> 
> So NAN does not appear as "nan" or "nan(0x7fffff)", as you might expect. It
> appears as "nan(0xffffff00000000)". 

If indeed there's no format specifier for a float (I don't have time
to dig into C9x, but I thought there was something like %hf, no?),
then it would at least be nice to be able to distinguish between a
double and a long double NaN.

So how about some code that would detect NaNs early on, before they
are converted to a long double?

- Raw text -


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