Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3E5D44B8.B932A2EC@phekda.freeserve.co.uk> Date: Wed, 26 Feb 2003 22:50:32 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: strtod.c: inf and nan support References: <200302261837 DOT h1QIbPN04902 AT speedy DOT ludd DOT luth DOT se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. ams AT ludd DOT luth DOT se wrote: > Here's what I've cooked up for supporting inf and nan in > strtod.c. When we're happt with this one I'll take care of strtof() > and strtold(). Cool. It looks good, but I have a couple of questions. [snip] > New file, djgpp/src/libc/c99/math/nan.c: > /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ > #include > > float_t __dj_nan = { 0x7fffff, 0xff, 0x0 }; > > Patch: > Index: djgpp/include/math.h > =================================================================== > RCS file: /cvs/djgpp/djgpp/include/math.h,v > retrieving revision 1.7 > diff -p -u -r1.7 math.h > --- djgpp/include/math.h 20 Feb 2003 19:04:02 -0000 1.7 > +++ djgpp/include/math.h 26 Feb 2003 18:26:53 -0000 > @@ -51,6 +51,11 @@ extern long double __dj_huge_vall; > #define HUGE_VALF __dj_huge_valf > #define HUGE_VALL __dj_huge_vall > > +#define INFINITY HUGE_VALF > + > +extern float __dj_nan; > +#define NAN __dj_nan > + > #endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */ > > #ifndef __STRICT_ANSI__ [snip] What does isnan(NAN) give? Does this affect the results given by tests/cygnus at all? C99 says that NAN should be a quiet NaN. "A quiet NaN propagates through almost every arithmetic operation without raising a floating-point exception; a signaling NaN generally raises a floating-point exception when occurring as an arithmetic operand." Is NAN a quiet NaN? I don't know enough about floating-point to answer this question. Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]