summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/__isnan.c
blob: 9d21e98241e9af195cdd1cf6c383a959e7586ab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>

int __isnan(double d) {
  unsigned long long *x=(unsigned long long *)&d;
  return (*x==0x7FF8002000000000ll || *x==0x7FF0002000000000);
}

#if 0
TestFromIeeeExtended("7FFF0000000000000000");   /* +infinity */
TestFromIeeeExtended("FFFF0000000000000000");   /* -infinity */
TestFromIeeeExtended("7FFF8001000000000000");   /* Quiet NaN(1) */
TestFromIeeeExtended("7FFF0001000000000000");   /* Signalling NaN(1) */
TestFromIeeeExtended("3FFFFEDCBA9876543210");   /* accuracy test */
#endif