Subject: Re: HUGE_VAL - NAN
To: Patrick Welche <prlw1@newn.cam.ac.uk>
From: Lars Hecking <lhecking@nmrc.ucc.ie>
List: port-arm32
Date: 04/19/2000 00:32:13
Patrick Welche writes:
> On Tue, Apr 18, 2000 at 12:06:34PM +0100, Richard Earnshaw wrote:
> > 
> > Can you supply a full test case?  The following gives the expected 
> > result... (This is on 1.4X (as of late March)).
> > 
> > 	double f = 0.0/0.0;  /* NaN */
> > 	main()
> > 	{
> > 	  printf("%g\n", f);
> > 	}
> > 
> > 	$ gcc nan.c
> > 	$ ./a.out
> > 	NaN
> > 	$
 
 Same result here on 1.4.2/amiga. What is 1.4X, btw?

> Your test case works for me too. I tried:
> 
> #include <math.h>
> #include <stdio.h>
> 
> int main()
> {
>   printf("+/-inifinity, EARLY:\n");
>   printf(" HUGE_VAL: % g\n", HUGE_VAL);
>   printf("-HUGE_VAL: % g\n",-HUGE_VAL);
> 
>   printf("invalid:\n");
> #ifdef NAN
>   printf("NAN: %g, isnan(NAN): %i\n",NAN,isnan(NAN));
> #else
>   printf("2min: %g\n",DBL_MIN+DBL_MIN);
> #endif
> 
>   return 0;
> }

 This doesn't even compile for me. NAN is nowhere defined,
 and to get DBL_MIN, I need to include <float.h>. The latter
 case produces

+/-inifinity, EARLY:
 HUGE_VAL:  Inf
-HUGE_VAL: -Inf
invalid:
2min: 4.45015e-308

 -l