This is an archive of the discontinued LLVM Phabricator instance.

Fix APFloat mod sign
ClosedPublic

Authored by skatkov on Oct 24 2017, 2:13 AM.

Details

Summary

IEEE specification requires the sign of the remainder is the same as numerator in case remainder is zero.

Diff Detail

Event Timeline

skatkov created this revision.Oct 24 2017, 2:13 AM

What can I do to make a progress with this fix?

scanon accepted this revision.Oct 30 2017, 9:32 AM

mod is not bound to the IEEE 754 remainder operation. It binds the C fmod operation. You're looking for the remainder operation.

However, fmod has the same requirement: "The fmod functions return the value x − ny, for some integer n such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y."

This revision is now accepted and ready to land.Oct 30 2017, 9:32 AM
This revision was automatically updated to reflect the committed changes.