Subject: Re: HUGE_VAL - NAN
To: Richard Earnshaw <rearnsha@arm.com>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: port-arm32
Date: 04/18/2000 13:00:34
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
> 	$

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;
}


+/-inifinity, EARLY:
 HUGE_VAL:  Inf
-HUGE_VAL: -Inf
invalid:
NAN: 3.31756e-39, isnan(NAN): 0


and from /sys/arch/arm32/include/math.h

#define NAN             (*(__const float *)(__const void *)__nanf)

cf i386:

+/-inifinity, EARLY:
 HUGE_VAL:  Inf
-HUGE_VAL: -Inf
invalid:
NAN: NaN, isnan(NAN): 1


Cheers,

Patrick