Mail Archives: djgpp-workers/2003/02/26/17:50:46
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 <libc/ieee.h>
>
> 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/ ]
- Raw text -