summaryrefslogtreecommitdiff
path: root/libm/float/nantst.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-10 00:40:28 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-10 00:40:28 +0000
commit1077fa4d772832f77a677ce7fb7c2d513b959e3f (patch)
tree579bee13fb0b58d2800206366ec2caecbb15f3fc /libm/float/nantst.c
parent22358dd7ce7bb49792204b698f01a6f69b9c8e08 (diff)
uClibc now has a math library. muahahahaha!
-Erik
Diffstat (limited to 'libm/float/nantst.c')
-rw-r--r--libm/float/nantst.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/libm/float/nantst.c b/libm/float/nantst.c
new file mode 100644
index 000000000..7edd992ae
--- /dev/null
+++ b/libm/float/nantst.c
@@ -0,0 +1,54 @@
+float inf = 1.0f/0.0f;
+float nnn = 1.0f/0.0f - 1.0f/0.0f;
+float fin = 1.0f;
+float neg = -1.0f;
+float nn2;
+
+int isnanf(), isfinitef(), signbitf();
+
+void pvalue (char *str, float x)
+{
+union
+ {
+ float f;
+ unsigned int i;
+ }u;
+
+printf("%s ", str);
+u.f = x;
+printf("%08x\n", u.i);
+}
+
+
+int
+main()
+{
+
+if (!isnanf(nnn))
+ abort();
+pvalue("nnn", nnn);
+pvalue("inf", inf);
+nn2 = inf - inf;
+pvalue("inf - inf", nn2);
+if (isnanf(fin))
+ abort();
+if (isnanf(inf))
+ abort();
+if (!isfinitef(fin))
+ abort();
+if (isfinitef(nnn))
+ abort();
+if (isfinitef(inf))
+ abort();
+if (!signbitf(neg))
+ abort();
+if (signbitf(fin))
+ abort();
+if (signbitf(inf))
+ abort();
+/*
+if (signbitf(nnn))
+ abort();
+ */
+exit (0);
+}