delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/12/17/07:10:22

Date: Thu, 17 Dec 1998 13:09:18 +0100
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199812171209.NAA06699@acp3bf.physik.rwth-aachen.de>
To: hankedr AT dms DOT auburn DOT edu (Darrel Hankerson)
Cc: djgpp-workers AT delorie DOT com
Subject: Re: strtod anomaly
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp-workers AT delorie DOT com

[Forwarded to djgpp-workers, from DJGPP newsgroup]

In article <x7n24nmqsn DOT fsf AT manatee DOT dms DOT auburn DOT edu> you wrote:
> strtod in 2.01 differs from that in Linux (gcc) and Solaris (Sun's cc)

This alone wouldn't mean much, of course, but unless I've read it
completely incorrectly, the ANSI spec seems to agree that there's a
problem, here.  An 'E' alone, without any digits to follow it, is not
a valid exponent suffix, and thus strtod should leave it alone.

>    #include <stdio.h>
>    #include <stdlib.h>
>    main() {
>      char *p; double d;
>      char buf[] = "2E";
>      d = strtod(buf, &p);
>      printf("%d\n", p-buf);  }

> giving 2, rather than 1.  This surfaced in a bug report on gawk, where
> the example

I don't have the necessary resources at hand to check wether this was
changed in 2.02. But if no-one else does it, I might jump in and fix
this.

--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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