+#ifdef __GNUC__
+/* typeof(x) if fp else double (using ?: with null pointers) */
+#define __RETCAST(x) (__typeof__(*( \
+ 0 ? (__typeof__(0 ? (double *)0 : (void *)__IS_FP(x)))0 : \
+ (__typeof__(0 ? (__typeof__(x) *)0 : (void *)!__IS_FP(x)))0 )))
+/* drop complex from the type of x */
+#define __TO_REAL(x) *( \
+ 0 ? (__typeof__(0 ? (double *)0 : (void *)!__DBLCX(x)))0 : \
+ 0 ? (__typeof__(0 ? (float *)0 : (void *)!__FLTCX(x)))0 : \
+ 0 ? (__typeof__(0 ? (long double *)0 : (void *)!__LDBLCX(x)))0 : \
+ (__typeof__(0 ? (__typeof__(x) *)0 : (void *)__IS_CX(x)))0 )
+#else
+#define __RETCAST(x)
+#endif
+
+#define __tg_real(fun, x) (__RETCAST(x)( \