aboutsummaryrefslogtreecommitdiff
path: root/math/tgmath.h
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/tgmath.h
parent495961c076f3f273b3fe893ba2f5dceb7aeb4a55 (diff)
downloadglibc-58d87ee17185dbd0b8f927c939343eaed34c8614.tar
glibc-58d87ee17185dbd0b8f927c939343eaed34c8614.tar.gz
glibc-58d87ee17185dbd0b8f927c939343eaed34c8614.tar.bz2
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/tgmath.h')
-rw-r--r--math/tgmath.h37
1 files changed, 34 insertions, 3 deletions
diff --git a/math/tgmath.h b/math/tgmath.h
index 168b262e68..0202e100bc 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -177,6 +178,36 @@
/* XXX This definition has to be changed as soon as the compiler understands
the imaginary keyword. */
+# define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
+ (__extension__ ({ __tgmath_real_type (Val) __tgmres; \
+ if (sizeof (__real__ (Val)) > sizeof (double) \
+ && __builtin_classify_type (__real__ (Val)) == 8) \
+ { \
+ if (sizeof (__real__ (Val)) == sizeof (Val)) \
+ __tgmres = __tgml(Fct) (Val); \
+ else \
+ __tgmres = __tgml(Cfct) (Val); \
+ } \
+ else if (sizeof (__real__ (Val)) == sizeof (double) \
+ || __builtin_classify_type (__real__ (Val)) \
+ != 8) \
+ { \
+ if (sizeof (__real__ (Val)) == sizeof (Val)) \
+ __tgmres = Fct (Val); \
+ else \
+ __tgmres = Cfct (Val); \
+ } \
+ else \
+ { \
+ if (sizeof (__real__ (Val)) == sizeof (Val)) \
+ __tgmres = Fct##f (Val); \
+ else \
+ __tgmres = Cfct##f (Val); \
+ } \
+ __real__ __tgmres; }))
+
+/* XXX This definition has to be changed as soon as the compiler understands
+ the imaginary keyword. */
# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
(__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \
if ((sizeof (__real__ (Val1)) > sizeof (double) \
@@ -420,9 +451,9 @@
/* Decomposing complex values. */
/* Imaginary part of Z. */
-#define cimag(Val) __TGMATH_UNARY_REAL_IMAG (Val, cimag, cimag)
+#define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, cimag, cimag)
/* Real part of Z. */
-#define creal(Val) __TGMATH_UNARY_REAL_IMAG (Val, creal, creal)
+#define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, creal, creal)
#endif /* tgmath.h */