https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89540
Bug ID: 89540 Summary: roundq(x) returning value with non-zero fractional part Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libquadmath Assignee: unassigned at gcc dot gnu.org Reporter: andres_takach at mentor dot com Target Milestone: --- Created attachment 45859 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45859&action=edit Test: c++ round_bug.cxx -lquadmath roundq should return an integer value (no fractional part), but it returns values with fractional part. The incorrect behavior seems to occur when values are big enough ( 2^31). The testcase has x = 2^31 + 0.5. In this case roundq(x) returns x, instead of 2^31 + 1. To exercise: c++ round_bug.cxx -lquadmath The output is (x, and roundq(x) are printed in both raw hex and decimal): 401e0000000100000000000000000000 2147483648.50000000000000000000000000000000000000000000000000 roundq(x) returns a value with fractional part 401e0000000100000000000000000000 2147483648.50000000000000000000000000000000000000000000000000 Incorrect behavior has also been confirmed with 6.2.0 and 4.9.2.