Cover the rest of the sin, cos and tan reduction - #1481
Merged
Merged
Conversation
- test_trig_rounding now tests -10^19, which uses the reduction with base-1e9 words for a negative x. - test_trig_rounding now tests 10^-80. For such a small x, fx_from gives 0 and the kernel uses x as the result. - to_words for a 128-bit significand returns 4 words. frexp10 gives 34 digits, thus the high word is never zero. Zero high words do not change the product. - The reduction does not test for a zero fraction. The worst cases have at most 37 leading zero digits and 117 leading zero bits, thus the fraction is never zero.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1481 +/- ##
=========================================
+ Coverage 98.7% 98.7% +0.1%
=========================================
Files 313 313
Lines 26252 26255 +3
Branches 2249 2246 -3
=========================================
+ Hits 25897 25908 +11
+ Misses 355 347 -8
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Member
|
LGTM. Merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR is a follow-up to #1475. It adds two test points for
sin,cosandtan, and it removes three branches of the reduction that no input can reach.New tests
test_trig_roundingnow tests -10^19. This value uses the reduction with base-1e9 words for a negative argument.test_trig_roundingnow tests 10^-80. For an argument this small,fx_fromgives 0, and the kernel uses the argument as the result.Removed branches
to_wordsfor a 128-bit significand now always returns 4 words.frexp10gives 34 digits, thus the high word is never zero. Zero high words do not change the product.Tests
GCC 16.2.1 and Clang 22.1.8, C++14 and C++20, with
-Wall -Wextra -Werror -Wconversion -Wsign-conversion -Wshadow -Wundef:test_trig_rounding,test_sin_cos,test_tan,test_cmathandtest_fenvpass.