v3.1.0: pow accepts negative bases with integer exponents - #12
Merged
Merged
Conversation
A negative base has a real power exactly when the exponent is an integer, so pow now computes |base|^exponent and applies the sign from the exponent's parity, read from the raw bits so it holds beyond i32. Non-integer exponents on a negative base still return the domain error, as sqrt does for a negative argument.
The accuracy harness sampled one argument per function. A TestedBinaryFunction variant samples two, pairing each base with an exponent from elsewhere in the sorted list so the arguments vary independently. pow is measured over bases in [0.05, 20] and exponents in [-3, 3], inside I16F16's range, and joins the README table and the baseline: I16F16 mean 6.90e-4, I32F32 mean 1.09e-8.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Follow-up to #11.
pownow accepts a negative base with an integer exponent, applying the sign from the exponent's parity (read from the raw bits, so it holds beyond i32). Non-integer exponents on a negative base remain a domain error, assqrtof a negative is: there is no real result. Zero base with a negative exponent likewise.powover bases in [0.05, 20] and exponents in [-3, 3]; it joins the README table and the baseline (new row, other rows unchanged).