Mail Archives: djgpp-workers/2009/09/14/18:43:18
Sorry, I have submited a somewhat broken test program.
diff -aprNU5 djgpp.orig/tests/libc/ansi/math/elefunt/atan2.c djgpp/tests/libc/ansi/math/elefunt/atan2.c
--- djgpp.orig/tests/libc/ansi/math/elefunt/atan2.c 1970-01-01 00:00:00 +0000
+++ djgpp/tests/libc/ansi/math/elefunt/atan2.c 2009-09-15 00:35:38 +0000
@@ -0,0 +1,48 @@
+#include <libc/ieee.h>
+#include <stdio.h>
+#include <errno.h>
+#include <math.h>
+
+
+int main(void)
+{
+ _double_union_t x, y;
+ double result;
+
+ y.d = M_PI;
+ x.dt.sign = 0;
+ x.dt.exponent = 0x07FF;
+ x.dt.mantissah = 0x000000000;
+ x.dt.mantissal = 0x000000000; /* +Infinity. */
+
+ /*
+ * Compute atan of the quotient of a positive finite number with pos. infinite.
+ * The result must be +0.0
+ */
+ errno = 0;
+ result = atan2(y.d, x.d);
+ if (errno)
+ printf("errno=%d\ny=%f x=%f: result=%f result must be +0.0\n", errno, y.d, x.d, result);
+ else if (result == +0.0)
+ printf("test passed.\n");
+ else
+ printf("test failure not triggered by atan2 bug.\n");
+
+
+ /*
+ * Compute atan of the quotient of a negative finite number with neg. infinite.
+ * The result must be -PI
+ */
+ errno = 0;
+ y.dt.sign = 1; /* -Finite value. */
+ x.dt.sign = 1; /* -Infinity. */
+ result = atan2(y.d, x.d);
+ if (errno)
+ printf("errno=%d\ny=%f x=%f: result=%f result must be -PI\n", errno, y.d, x.d, result);
+ else if (result == -M_PI)
+ printf("test passed.\n");
+ else
+ printf("test failure not triggered by atan2 bug.\n");
+
+ return 0;
+}
- Raw text -