NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-alpha/48043: IEEE FP issue with NANs

>Number:         48043
>Category:       port-alpha
>Synopsis:       IEEE FP issue with NANs
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-alpha-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 10 11:20:00 +0000 2013
>Originator:     Nicolas Joly
>Release:        NetBSD 6.99.23
Insitut Pasteur
System: NetBSD 6.99.23 NetBSD 6.99.23 (GENERIC-$Revision: 
1.353 $) #5: Sun Jul 7 15:32:41 CEST 2013
Architecture: alpha
Machine: alpha
For quite some time now, i do see problems with NANs for IEEE FP.
No idea what going on, but they often become a value of 0.

njoly@thanos [~]> cat nan.c 
#include <math.h>
#include <stdio.h>

int main() {
  double d, r;

  d = NAN;
  printf("d %f\n", d);
  r = d + 0.0;
  printf("r %f\n", r);

  return 0; }

njoly@thanos [~]> cc -mieee -g -O2 -o nan nan.c    
njoly@thanos [~]> ./nan 
d 0.000000
r 0.000000

No problem if compiled without -mieee :

njoly@thanos [~]> cc -g -O2 -o nan nan.c 
njoly@thanos [~]> ./nan 
d nan
r nan

Run the testcase ... see unexpected 0.0 results.

Home | Main Index | Thread Index | Old Index