https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81906
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 42809 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42809&action=edit gcc8-pr81906.patch The above in patch form. Note that: xa = fabs (operand1); a2_52 = 2**52; [if flag_rounding_math] a2_52 = copysign (a2_52, operand1); xa = xa + a2_52 - a2_52; return copysign (xa, operand1); is incorrect for negative operand1, because if we use negative a2_52, then we need to use xa = operand1 + a2_52 - a2_52; rather than xa = xa + a2_52 - a2_52; otherwise say rint (-2.5) is -2.5.