https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121207
Bug ID: 121207 Summary: __LDBL_EPSILON__ is wrongly defined on power platforms. Product: gcc Version: 15.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: cassio.neri at gmail dot com Target Milestone: --- On power, power64 and power64le (where long double is the IBM128 format) __LDBL_EPSILON__ is defined with the same value as __LDBL_DENORM_MIN__. See https://godbolt.org/z/qTTaWsovq Consequently, 1.0l + __LDBL_EPSILON__ isn't the minimum long double value greater than 1.0l. Indeed, in the code below the assert fires when EPSILON is undefined but, otherwise, it doesn't. The code also shows that __LDBL_EPSILON__ should be defined as 2^(-105) ~= 2.465190328815662e-32l. #include <cassert> #include <cmath> #include <limits> int main() { #ifdef EPSILON auto const epsilon = 2.465190328815662e-32l; // == 2^(-105) #else auto const epsilon = std::numeric_limits<long double>::epsilon(); #endif auto const x1 = 1.0l + epsilon; auto const x2 = std::nextafter(1.0l, 2.0l); assert(x1 == x2); }