Conversion from 128-bit long double to float goes via double. This means the
conversions suffers from double rounding, and incorrect results may be
calculated for long double values near the midpoint of two adjacent float
values.
For example, f and g should have different values in the following.
#ifndef DO_DOUBLE
#define FP float
#define FP_MANT 24
#else
#define FP double
#define FP_MANT 53
#endif
volatile long double x;
volatile long double y;
int main (void)
{
FP f, g;
x = (1ull << 63) + (1ull << (63 - FP_MANT));
y = 1.0;
f = x + y;
g = x - y;
return f == g;
}
--
Summary: Wrong long double to float conversion
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amodra at bigpond dot net dot au
GCC target triplet: powerpc64-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25661