Subject: lib/9931: NaN incorrect (arm32)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <prlw1@cam.ac.uk>
List: netbsd-bugs
Date: 04/19/2000 04:18:23
>Number:         9931
>Category:       lib
>Synopsis:       NaN is incorrect on arm32
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 19 04:19:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Patrick Welche
>Release:        15 April 2000
>Organization:
	
>Environment:
NetBSD-1.4X/arm32


>Description:
NaN is a number on arm32
>How-To-Repeat:
#include <math.h>
#include <stdio.h>

int main()
{
  printf("NAN: %g, isnan(NAN): %i\n",NAN,isnan(NAN));

  return 0;
}

Output before applying patch:

NAN: 3.31756e-39, isnan(NAN): 0

Output (correct) after applying patch:

NAN: NaN, isnan(NAN): 1

>Fix:
Thanks to Richard Earnshaw:

Index: nanf.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/arch/arm32/gen/nanf.c,v
retrieving revision 1.1
diff -c -r1.1 nanf.c
*** nanf.c	1999/12/23 10:15:06	1.1
--- nanf.c	2000/04/19 11:18:29
***************
*** 10,13 ****
  #include <math.h>
  
  /* bytes for quiet NaN on an arm32 (IEEE single precision) */
! const char __nanf[] = { 0, 0, (char)0xc0, 0x7f };
--- 10,13 ----
  #include <math.h>
  
  /* bytes for quiet NaN on an arm32 (IEEE single precision) */
! const char __nanf[] __attribute__((aligned(2))) = { 0, 0, (char)0xc0, 0x7f };
>Release-Note:
>Audit-Trail:
>Unformatted: