This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug: atof() can't parse "NaN"


Hi folks,

While fixing up glib-2.6.0 to build, I found a failure in the
floating-point tests.  This is seemingly because atof() is bust.
This is a trivial example:


/* for NAN and INFINITY */
#define _ISOC99_SOURCE

#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ieeefp.h>

int 
main ()
{
  double our_nan;

#ifdef NAN
  our_nan = NAN;
#else
  /* Do this before any call to setlocale.  */
  our_nan = atof ("NaN");
#endif
  assert (isnan (our_nan));

  return 0;
} 


When I run this (current net release) the assert fails, and it
segfaults.


Regards,
Roger

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]