This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
<tgmath.h> bug for binary and ternary functions with int and floatarguments
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Tue, 29 Mar 2005 19:05:05 +0000 (UTC)
- Subject: <tgmath.h> bug for binary and ternary functions with int and floatarguments
The definitions in <tgmath.h> of __TGMATH_BINARY_REAL_ONLY,
__TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY, __TGMATH_TERNARY_REAL_ONLY,
__TGMATH_BINARY_REAL_IMAG are buggy when the function has arguments of
type float and an integer type. If any argument is of integer type then
the function chosen should be that for double or long double according to
whether any other argument has type long double, not that for float even
if all other arguments have type float, and the type of the result should
be determined accordingly. For example,
int x;
float y;
sizeof(pow(x, y)); // Has value sizeof(double).
I believe __typeof((__tgmath_real_type(Val1))0 +
(__tgmath_real_type(Val2))0) should be used in place of __tgmath_real_type
((Val1) + (Val2)), and similarly for ternary functions.
--
Joseph S. Myers
joseph@codesourcery.com