https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79528

yuki.tanaka at defaultcase dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yuki.tanaka at defaultcase dot 
de

--- Comment #4 from yuki.tanaka at defaultcase dot de ---
__attribute__((noipa)) _Decimal32 a(void)
{
  return 1.2345665f128;
}

int main(void)
{
  if (a() != 1.234567DF)
    __builtin_abort();
  return 0;
}

The same happens for conversions from a binary floating-point constant. The
_Float128 value nearest to 1.2345665 is slightly larger than 1.2345665, so the
correctly rounded _Decimal32 value is 1.234567DF. Instead a returns 1.234566DF
and main aborts.

Compiler Explorer:
https://godbolt.org/z/6MdeoWh3E

Rounded to 34 digits the value is exactly 1.2345665, and that tie then goes to
even. The run-time conversion (__bid_trunctfsd) returns 1.234567DF, and
_Decimal64 is affected too (1.2345678901234585f128 gives 1.234567890123458DD
instead of 1.234567890123459DD).

Reply via email to