about summary refs log tree commit diff
path: root/math/bug-tgmath1.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-05-06 18:58:29 +0000
committerUlrich Drepper <drepper@redhat.com>2004-05-06 18:58:29 +0000
commit58d87ee17185dbd0b8f927c939343eaed34c8614 (patch)
tree02fee9d4bd5236d302f6261685eb07e8312e1a95 /math/bug-tgmath1.c
parent495961c076f3f273b3fe893ba2f5dceb7aeb4a55 (diff)
downloadglibc-58d87ee17185dbd0b8f927c939343eaed34c8614.tar.gz
glibc-58d87ee17185dbd0b8f927c939343eaed34c8614.tar.xz
glibc-58d87ee17185dbd0b8f927c939343eaed34c8614.zip
Update.
2004-05-06  Ulrich Drepper  <drepper@redhat.com>

	* math/tgmath.h (__TGMATH_UNARY_REAL_IMAG_RET_REAL):Define.
	(cimag): Use it.
	(creal): Likewise.
	* math/Makefile (tests): Add bug-tgmath1.
	* math/bug-tgmath1.c: New file.
Diffstat (limited to 'math/bug-tgmath1.c')
-rw-r--r--math/bug-tgmath1.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/math/bug-tgmath1.c b/math/bug-tgmath1.c
new file mode 100644
index 0000000000..8a457fa252
--- /dev/null
+++ b/math/bug-tgmath1.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <tgmath.h>
+
+
+int
+main (void)
+{
+  int retval = 0;
+
+#define TEST(expr, res) \
+  if (sizeof (expr) != res)						      \
+    {									      \
+      printf ("sizeof(%s) == %zu, expected %zu\n", #expr,		      \
+	      sizeof (expr), (size_t) (res));				      \
+      retval = 1;								      \
+    }
+
+  TEST (creal (1.0), sizeof (double));
+  TEST (creal (1.0 + 1.0i), sizeof (double));
+  TEST (creal (1.0l), sizeof (long double));
+  TEST (creal (1.0l + 1.0li), sizeof (long double));
+  TEST (creal (1.0f), sizeof (float));
+  TEST (creal (1.0f + 1.0fi), sizeof (float));
+
+  TEST (cimag (1.0), sizeof (double));
+  TEST (cimag (1.0 + 1.0i), sizeof (double));
+  TEST (cimag (1.0l), sizeof (long double));
+  TEST (cimag (1.0l + 1.0li), sizeof (long double));
+  TEST (cimag (1.0f), sizeof (float));
+  TEST (cimag (1.0f + 1.0fi), sizeof (float));
+
+  return retval;
+}