summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c99-math.h
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/c99-math.h
downloadcbb-gcc-4.6.4-upstream.tar.bz2
cbb-gcc-4.6.4-upstream.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/c99-math.h')
-rw-r--r--gcc/testsuite/gcc.dg/c99-math.h236
1 files changed, 236 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c99-math.h b/gcc/testsuite/gcc.dg/c99-math.h
new file mode 100644
index 000000000..81f2e6ddb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-math.h
@@ -0,0 +1,236 @@
+#include <math.h>
+#include <fenv.h>
+
+extern void abort(void);
+
+#define C99_MATH_TESTS(nan, inf, huge, norm1, norm2, norm3, sub, zero, neg) \
+{ \
+ if (feclearexcept (FE_ALL_EXCEPT) != 0) \
+ abort(); \
+ \
+ \
+ if (fpclassify (nan) != FP_NAN) \
+ abort (); \
+ \
+ if (fpclassify (inf) != FP_INFINITE) \
+ abort (); \
+ \
+ if (fpclassify (huge) != FP_INFINITE) \
+ abort (); \
+ \
+ if (fpclassify (norm1) != FP_NORMAL) \
+ abort (); \
+ \
+ if (fpclassify (norm2) != FP_NORMAL) \
+ abort (); \
+ \
+ if (fpclassify (norm3) != FP_NORMAL) \
+ abort (); \
+ \
+ if (fpclassify (sub) != FP_SUBNORMAL) \
+ abort (); \
+ \
+ if (fpclassify (zero) != FP_ZERO) \
+ abort (); \
+ \
+ \
+ if (!isnan (nan)) \
+ abort (); \
+ \
+ if (isnan (inf)) \
+ abort (); \
+ \
+ if (isnan (huge)) \
+ abort (); \
+ \
+ if (isnan (norm1)) \
+ abort (); \
+ \
+ if (isnan (norm2)) \
+ abort (); \
+ \
+ if (isnan (norm3)) \
+ abort (); \
+ \
+ if (isnan (sub)) \
+ abort (); \
+ \
+ if (isnan (zero)) \
+ abort (); \
+ \
+ \
+ if (isinf (nan)) \
+ abort (); \
+ \
+ if (!isinf (inf)) \
+ abort (); \
+ \
+ if (!isinf (huge)) \
+ abort (); \
+ \
+ if (isinf (norm1)) \
+ abort (); \
+ \
+ if (isinf (norm2)) \
+ abort (); \
+ \
+ if (isinf (norm3)) \
+ abort (); \
+ \
+ if (isinf (sub)) \
+ abort (); \
+ \
+ if (isinf (zero)) \
+ abort (); \
+ \
+ \
+ if (isfinite (nan)) \
+ abort (); \
+ \
+ if (isfinite (inf)) \
+ abort (); \
+ \
+ if (isfinite (huge)) \
+ abort (); \
+ \
+ if (!isfinite (norm1)) \
+ abort (); \
+ \
+ if (!isfinite (norm2)) \
+ abort (); \
+ \
+ if (!isfinite (norm3)) \
+ abort (); \
+ \
+ if (!isfinite (sub)) \
+ abort (); \
+ \
+ if (!isfinite (zero)) \
+ abort (); \
+ \
+ \
+ if (isnormal (nan)) \
+ abort (); \
+ \
+ if (isnormal (inf)) \
+ abort (); \
+ \
+ if (isnormal (huge)) \
+ abort (); \
+ \
+ if (!isnormal (norm1)) \
+ abort (); \
+ \
+ if (!isnormal (norm2)) \
+ abort (); \
+ \
+ if (!isnormal (norm3)) \
+ abort (); \
+ \
+ if (isnormal (sub)) \
+ abort (); \
+ \
+ if (isnormal (zero)) \
+ abort (); \
+ \
+ \
+ if (!!signbit (nan) != neg) \
+ abort (); \
+ \
+ if (!!signbit (inf) != neg) \
+ abort (); \
+ \
+ if (!!signbit (huge) != neg) \
+ abort (); \
+ \
+ if (!!signbit (norm1) != neg) \
+ abort (); \
+ \
+ if (!!signbit (norm2) != neg) \
+ abort (); \
+ \
+ if (!!signbit (norm3) != neg) \
+ abort (); \
+ \
+ if (!!signbit (sub) != neg) \
+ abort (); \
+ \
+ if (!!signbit (zero) != neg) \
+ abort (); \
+ \
+ \
+ if (neg) \
+ { \
+ if (!isless ((inf), (norm1))) \
+ abort (); \
+ \
+ if (!isless ((inf), (norm2))) \
+ abort (); \
+ \
+ if (!isless ((inf), (norm3))) \
+ abort (); \
+ \
+ if (!islessequal ((inf), (huge))) \
+ abort (); \
+ \
+ if (!isgreater ((norm1), (inf))) \
+ abort (); \
+ \
+ if (!isgreater ((norm2), (inf))) \
+ abort (); \
+ \
+ if (!isgreater ((norm3), (inf))) \
+ abort (); \
+ \
+ if (!isgreaterequal ((huge), (inf))) \
+ abort (); \
+ } \
+ else \
+ { \
+ if (!isgreater ((inf), (norm1))) \
+ abort (); \
+ \
+ if (!isgreater ((inf), (norm2))) \
+ abort (); \
+ \
+ if (!isgreater ((inf), (norm3))) \
+ abort (); \
+ \
+ if (!isgreaterequal ((inf), (huge))) \
+ abort (); \
+ \
+ if (!isless ((norm1), (inf))) \
+ abort (); \
+ \
+ if (!isless ((norm2), (inf))) \
+ abort (); \
+ \
+ if (!isless ((norm3), (inf))) \
+ abort (); \
+ \
+ if (!islessequal ((huge), (inf))) \
+ abort (); \
+ } \
+ \
+ if (!islessgreater ((inf), (norm1))) \
+ abort (); \
+ \
+ if (!islessgreater ((inf), (norm2))) \
+ abort (); \
+ \
+ if (!islessgreater ((inf), (norm3))) \
+ abort (); \
+ \
+ if (!isunordered ((nan), (norm1))) \
+ abort (); \
+ \
+ if (!isunordered ((nan), (norm2))) \
+ abort (); \
+ \
+ if (!isunordered ((nan), (norm3))) \
+ abort (); \
+ \
+ \
+ if (fetestexcept (FE_ALL_EXCEPT) != 0) \
+ abort(); \
+}