Repository navigation
A compiled power over double of a value that does not exist has none - #2252
Open
Rafael-SOWNet wants to merge 1 commit into
Open
Rafael-SOWNet wants to merge 1 commit into
Rafael-SOWNet wants to merge 1 commit into
Conversation
Compile<double, ...> and Compile<float, ...> took a power by Math.Pow, for which NaN^0 and 1^NaN are 1, so (x provided x > 1)^0 at 0.7 was 1, and ((x provided x > 1)^Im(x)) * sin(-2) was -0.909, where neither has a value. Evaluation has none, and FastExpression and the compilers over Complex have had none since #2225. The power is NaN now where either side is. A NaN over double also stands for a value that is not real, so (sqrt(x - 2))^0 at 0.7, which is 1, is NaN now, where it was 1 by Math.Pow's NaN^0. That is a decline where there was an answer by coincidence, as sqrt(x - 2) + 1 - sqrt(x - 2) was already a decline there; the other way round, a value where there is none, was a wrong answer. PowerOfNaNOverDoubleTest takes five powers with no value over double, by FastExpression and in evaluation, two over float, and four with a value. Found by work/compilesweep. Fixes #2250. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2252 +/- ##
==========================================
- Coverage 86.71% 86.70% -0.02%
==========================================
Files 310 310
Lines 67785 67785
Branches 19664 19666 +2
==========================================
- Hits 58781 58773 -8
- Misses 4892 4899 +7
- Partials 4112 4113 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Compile<double, ...>andCompile<float, ...>took a power withMath.Pow, for whichNaN^0and1^NaNare1. So a power of a value that does not exist had one. A power whose base or exponent isNaNis nowNaN, as it is in evaluation, in FastExpression and in the compilers overComplex(#2225).double(x provided x > 1)^01NaN1^(x provided x > 1)1NaN((x provided x > 1)^Im(x)) * sin(-2)-0.909NaNOver
double, aNaNalso stands for a value that is not real. So(sqrt(x - 2))^0at 0.7, which is 1, was 1 only byMath.Pow's rule and is nowNaN, assqrt(x - 2) + 1 - sqrt(x - 2)already was there. The change trades a coincidental answer for a decline, and removes a value where there is none.Not changed here:
0^0and0^(-1)overdoublestayMath.Pow's1and+oo, just as1/0overdoubleis still+oo. FastExpression andComplexhave no value at either (#2225, #2235). Whether thedoublecompiler should follow is a separate decision.PowerOfNaNOverDoubleTest: six cases with no value fail on master, and four cases with a value pass on both. Suite 18177 passed. The F# wrapper suite, the Mcp, Terminal and InteractiveWrapper suites and the AOT smoke test pass.Fixes #2250.
🤖 Generated with Claude Code