hack で頑張ったり GCC 拡張を使ったり
integer なら double を、浮動小数点ならその型を使いたい
/* This is ugly but unless gcc gets appropriate builtins we have to do
something like this. Don't ask how it works. */
/* 1 if 'type' is a floating type, 0 if 'type' is an integer type.
Allows for _Bool. Expands to an integer constant expression. */
#define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))
/* The tgmath real type for T, where E is 0 if T is an integer type and
1 for a floating type. */
#define __tgmath_real_type_sub(T, E) \
__typeof__(*(0 ? (__typeof__(0 ? (double *)0 : (void *)(E)))0 \
: (__typeof__(0 ? (T *)0 : (void *)(!(E))))0))
/* The tgmath real type of EXPR. */
#define __tgmath_real_type(expr) \
__tgmath_real_type_sub(__typeof__(expr), __floating_type(__typeof__(expr)))