delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2008/04/23/12:04:37

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Date: Wed, 23 Apr 2008 10:04:07 -0500
From: JT Williams <jtw AT sfbrgenetics DOT org>
Subject: Re: Printing signed zeros and nans
In-reply-to: <200804231521.03091.juan.guerrero@gmx.de>
To: djgpp-workers AT delorie DOT com
Message-id: <20080423150406.GA29173@sfbrgenetics.org>
MIME-version: 1.0
References: <200804231521 DOT 03091 DOT juan DOT guerrero AT gmx DOT de>
User-Agent: Mutt/1.5.15 (2007-04-06)
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

Curious, I checked under Solaris and Darwin:

% cat foo.c
#include <stdio.h>
int main(void) {
  printf("%f\n", -0.0);
  printf("%+f\n", -0.0);
  return 0;
}

% gcc foo.c -o foo

% uname -a
SunOS quantum 5.10 Generic_118833-24 sun4u sparc SUNW,Ultra-60 Solaris
% ./foo
-0.000000
-0.000000

% uname -a
Darwin quantum.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar  4 21:23:43 PST 2008; root:xnu-1228.4.31~1/RELEASE_PPC Power Macintosh
% ./foo
-0.000000
-0.000000

-- 
j

On Wed|2008.04.23, Juan Manuel Guerrero wrote:

>The following line:
>  printf("%f", -0.0);
>produces on linux the following output:
>  -0.000000
>but with djgpp this one:
>  0.000000
>To get the same output, the djgpp line must look like this:
>  printf("%+f", -0.0);
>Is this intentional?
>
>Regards,
>Juan M. Guerrero

- Raw text -


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