Skip to content

Read a compiled power's constant exponent for its value - #2339

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-compiled-root-of-a-constant-exponent
Nov 3, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-compiled-root-of-a-constant-exponent

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Both compilers take the real root of a negative real for a rational exponent with an odd denominator below ten, as evaluation does (#2318). They only recognised the exponent when it was written as a rational. Any other spelling compiled to the principal power:

Compile("x").Call(-8) 2.6.0 master this PR evaluated
x^(1/3) <1.0000000000000002; 1.7320508075688772> <-2; 0> <-2; 0> -2
x^(1/(1 + 2)) <1.0000000000000002; 1.7320508075688772> <1.0000000000000002; 1.7320508075688772> <-2; 0> -2
x^(3^(-1)) <1.0000000000000002; 1.7320508075688772> <1.0000000000000002; 1.7320508075688772> <-2; 0> -2
x^((1/3) provided 2 > 1) <1.0000000000000002; 1.7320508075688772> <1.0000000000000002; 1.7320508075688772> <-2; 0> -2

Over double each of the last three was NaN.

An exponent with no variable is now read for its value through InnerSimplified, in both compilers, by RealProducts.RealRootExponent. An exponent written as a rational short-circuits, so nothing that already compiled changes.

Found by compilesweep at seed 13, on (sin(x))^(1/(3 provided 3 > 1)) at -1.3. No issue was filed. The four new rows in CompiledOddRootTest fail on master. The suite (18747), the five test projects and the eight harnesses pass, with 0 warnings. #2318's BREAKING entry gains a sentence and a row.

🤖 Generated with Claude Code

Both compilers take the real root of a negative real for a rational
exponent with an odd denominator below ten, as evaluation does, but only
where the exponent was written as a rational. Written otherwise it was the
principal power: x^(1/(1 + 2)), x^(3^(-1)) and x^((1/3) provided 2 > 1)
compiled to 1 + 1.73i at -8, and NaN over double, where evaluation reads the
exponent as 1/3 and is -2. An exponent with no variable is now read for its
value, through InnerSimplified, in both compilers.

Found by compilesweep at seed 13, on (sin(x))^(1/(3 provided 3 > 1)) at
-1.3; no issue was filed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 3, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 3, 2026
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.77%. Comparing base (493b7ef) to head (261bcb4).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2339      +/-   ##
==========================================
+ Coverage   86.76%   86.77%   +0.01%     
==========================================
  Files         312      312              
  Lines       68598    68600       +2     
  Branches    19962    19963       +1     
==========================================
+ Hits        59519    59529      +10     
+ Misses       4914     4905       -9     
- Partials     4165     4166       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.32% <100.00%> (+0.01%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...gouriMath/Functions/Compilation/IntoFE/Compiler.cs 85.71% <100.00%> (+0.25%) ⬆️
...ctions/Compilation/IntoLinq/CompilationProtocol.cs 93.94% <100.00%> (ø)
.../AngouriMath/Functions/Compilation/RealProducts.cs 91.30% <100.00%> (+0.39%) ⬆️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit d5a279c into master Nov 3, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 3, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-compiled-root-of-a-constant-exponent branch November 3, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant