X-Spam-Check-By: sourceware.org Date: Tue, 20 Jun 2006 19:18:35 +0200 From: Corinna Vinschen To: newlib AT sourceware DOT org Cc: cygwin AT cygwin DOT com Subject: Re: strtod (and atof) on hex numbers Message-ID: <20060620171835.GH29251@calimero.vinschen.de> Reply-To: newlib AT sourceware DOT org Mail-Followup-To: newlib AT sourceware DOT org, cygwin AT cygwin DOT com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 > #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 -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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/