Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on updating the libm crate in Debian I ran into a test failure on Debian i386.
Debian i386 uses the x87 FPU. The x87 FPU suffers from excess precision, where intermediate values are calculated in a higher precsion than their nominal data types can store. Most of the time this results in the results of calculations being slightly more accurate than expected, but when code tries to play tricks with rounding it can result in massively incorrect results.
To work around this, the libm crate contains a force_eval! macro which forces the value to be stored to memory and hence forces it to be rounded to it's nominal data type. This macro is used in a number of places where we need to ensure values are correctly rounded to their nominal format. This was implemented by my previous accepted pull request. #249
However since that was implemented, two new functions rint and rintf were added. These did not take any steps to force rounding to the storage format and hence fail on x87. This PR implements forced rounding in those functions on x87. On other architectures it should be a no-op.