delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/22/14:04:30

X-Spam-Check-By: sourceware.org
Message-ID: <449ADB9B.6010105@redhat.com>
Date: Thu, 22 Jun 2006 14:04:11 -0400
From: Jeff Johnston <jjohnstn AT redhat DOT com>
User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)
MIME-Version: 1.0
To: Jeff Johnston <jjohnstn AT redhat DOT com>
Cc: newlib AT sourceware DOT org, cygwin AT cygwin DOT com
Subject: Re: strtod (and atof) on hex numbers
References: <af54caaf0606201000o4df93c69scbc55bf24f12915d AT mail DOT gmail DOT com> <20060620171835 DOT GH29251 AT calimero DOT vinschen DOT de> <44983B60 DOT 7010903 AT redhat DOT com>
In-Reply-To: <44983B60.7010903@redhat.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I have integrated a newer version of strtod from David M. Gay's gdtoa 
FreeBSD code.  This code has the C99 support in question including nan 
and inf support.  I have tested on x86-linux and mn10300.

As usual, please run it through its paces on Cygwin and let me know if 
there are any problems.

-- Jeff J.

Jeff Johnston wrote:
> This is a C99 extension to strtod over original ANSI C90 which is what 
> newlib started with.  I'll start working on it, but don't expect 
> anything too quick.
> 
> -- Jeff J.
> 
> Corinna Vinschen wrote:
> 
>> This is a newlib issue.  I redirected this to the appropriate mailing
>> list newlib AT sourceware DOT org.
>>
>>
>> On Jun 20 13:00, Paul Biggar wrote:
>>
>>> Hi,
>>>
>>> atof (and hence strtod) on hexadecimal numbers results in 0.0 (errno
>>> of 0). This may be related to an old issue where NaN isnt correctly
>>> parsed. I believe it isnt correct behaviour:
>>>
>>> http://www.opengroup.org/onlinepubs/000095399/functions/atof.html
>>>
>>>
>>>
>>> I've tested it for integers in the range 0x8000000 to 0xFFFFFFFF. It
>>> works properly on
>>>
>>> ubuntu dapper, gcc 4.1 on i386;
>>> debian stable, gcc 3.3 on amd64
>>> sunos ?, gcc 3.4 on sparc
>>>
>>> I'm using standard cygwin distribution, which uses gcc 3.4.4 (cygming 
>>> special)
>>>
>>> Sample code:
>>>
>>> #include "limits.h"
>>> #include <iostream.h>
>>> #include "errno.h"
>>>
>>> int main()
>>>
>>> {
>>>       cout << ULONG_MAX << endl;
>>>       cout << 0xFFFFFFFF << endl;
>>>
>>>       errno = 0;
>>>       cout << atof("0xFFFFFFFF") << endl;
>>>       cout << errno << endl;
>>>
>>>       errno = 0;
>>>       cout << strtod("0xFFFFFFFF", NULL) << endl;
>>>       cout << errno << endl;
>>>
>>> }
>>>
>>>
>>> Is this being fixed? I could find a mention of it before. Does anyone
>>> know a simple workaround?
>>>
>>> Thanks
>>> Paul
>>
>>
>>
>> Corinna
>>
> 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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