https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80137
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- We need to handle targets without C99's nextafter, but maybe this would be OK: if (__builtin_expect(__ret >= _RealType(1), 0)) { #if _GLIBCXX_USE_C99_MATH_TR1 __ret = std::nextafter(_RealType(1), _RealType(0)); #else __ret = _RealType(0); #endif } If we reach 1.0 it's because we're rounding up or to nearest, and so returning zero in that case would counteract the decreased probability of getting zero otherwise.