Repository navigation
Evaluate an exact power too large to build as the decimal - #2347
Merged
Merged
Conversation
An exact number to a whole power was built exactly however large, so 46655^(10^20), which has 4.7e20 digits, neither returned nor stopped when cancelled, and nor did a simplification of anything holding it. Found by compilesweep on (x^x - 1)^(e^(e^x)) at 6; 2.6.0 does not finish it either. Past 2^24 bits the power is evaluated in the decimal context, as the same power with a half added already was: +oo past the range, -oo for an odd power of a negative base, 0 below it. The exact powers of -1, i and -i are unchanged, and so is every exact power that finishes today (3^(10^7) in 3.3 s). An exact simplification leaves such a power as written: an infinity counts as exact, so without a guard 2^(10^10) simplified to +oo. 46655^(10^20) now evaluates in 38 ms. The eight large cases each hit the 30 s cap on master and pass here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2347 +/- ##
==========================================
- Coverage 86.78% 86.77% -0.01%
==========================================
Files 312 312
Lines 68620 68645 +25
Branches 19971 19980 +9
==========================================
+ Hits 59549 59570 +21
- Misses 4903 4907 +4
Partials 4168 4168
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Rafael-SOWNet
added a commit
that referenced
this pull request
Nov 3, 2026
IsFinite is a cache made on an entity's first read of it, and each number an evaluation or a power produces is a new entity. Asked of every exact value in the exact-evaluation shortcut (the guard #2347 added) and of every power built (the check this branch added), it cost about 250 KB and 237 KB on each solve of the kernel benchmark's SolveHard, +5.1% against the gate's baseline. The parts answer the same question without the cache, a rational part being finite as it is. The size bound #2347 added is computed in longs as well; it measured free as EIntegers, but it is asked of every exact power. SolveHard allocates 9,549,209 B, against 9,546,434 B before #2347 and 10,027,870 B before this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rafael-SOWNet
added a commit
that referenced
this pull request
Nov 3, 2026
) A complex number's parts are decimals in the precision context, whose exponents end at 1e1000. A product or a whole power of finite numbers, a part of which passed that end on the way, had oo - oo in it and was NaN: (3+4i)^2000, (1+i)^(10^6) and (1e600+1e600i)^2, and Simplify returned the NaN as well. 2.6.0 does the same. A complex product whose parts leave the range is formed with unbounded exponents and each part rounded into the context, and a complex power that does is raised the same way. Each part past the range is the infinity of its sign, as a real past it is +oo; within the range nothing changes, since the bounded result is used whenever it is finite. (1+i)^(10^6) is +oo and (1e600+1e600i)^2 is +oo i. The guard against an infinity only rounding made now covers any sum, product or power of exact finite operands (a power's base not zero), which is exact and finite, so an exact simplification leaves (3+4i)^2000 as written. An operand that is already a decimal is not covered: the integrator reads a decimal sample past the range as +oo, and taking that away made one Rubi antiderivative 23,030 characters long. Read finiteness from a number's parts where every evaluation passes IsFinite is a cache made on an entity's first read of it, and each number an evaluation or a power produces is a new entity. Asked of every exact value in the exact-evaluation shortcut (the guard #2347 added) and of every power built (the check this branch added), it cost about 250 KB and 237 KB on each solve of the kernel benchmark's SolveHard, +5.1% against the gate's baseline. The parts answer the same question without the cache, a rational part being finite as it is. The size bound #2347 added is computed in longs as well; it measured free as EIntegers, but it is asked of every exact power. SolveHard allocates 9,549,209 B, against 9,546,434 B before #2347 and 10,027,870 B before this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
An exact number to a whole power was built exactly however large.
46655^(10^20)has 4.7e20 digits, so its evaluation neither returned nor stopped when cancelled, and nor didSimplifyof anything holding it. compilesweep found it on(x^x - 1)^(e^(e^x))at 6. 2.6.0 does not finish it either. No issue was filed.Past 2^24 bits (about five million digits) the power is now evaluated in the decimal context, the way
2^(10^7 + 0.5)already was:46655^(10^20)evaluated+oo, 38 ms(-3)^(10^20 + 1)-oo(1/3)^(10^20)0"2^(10^10)".Simplify()2 ^ 100000000003^(10^7),i^(10^20),(-1)^(10^20+1)An exact simplification leaves such a power as written. The library counts an infinity as exact, so without a guard
2^(10^10)would have simplified to+oo. The guard refuses an infinity whose only source is an oversized exact power.Tests:
AnExactPowerTooLargeToBuildTest, 12 cases under a 30 s cap each. The eight large cases fail on master by the cap; the four controls pass on both. The full suite, AOT and the nine harnesses pass. There is a BREAKING-CHANGES entry, measured on 2.6.0.🤖 Generated with Claude Code