Repository navigation
A power of a constant below 1e-50 is no longer simplified to zero - #1772
Merged
Rafael-SOWNet merged 1 commit intoOct 5, 2026
Merged
Conversation
InnerSimplified takes a node's value where that value is an exact number, and evaluation rounds a value within 1e-50 of an integer onto it, so 1/pi^136, about 2.4e-68, became 0, and Simplify, which raises constants to such powers on its way, returned 0 for expressions that are not zero. A product, a quotient or a power of numbers none of which is zero, or a sum of such numbers of one sign, is kept as written now; evaluation still rounds. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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.
Closes #1769.
1/pi^136, about2.4e-68, inner-simplified to0, and so did any product, quotient or power of constants below1e-50.Simplifyraises constants to such powers on its way, and returned0for expressions that are not zero:85d6601c1/pi^136, inner-simplified001/pi^136e^(-160), inner-simplified00e^(-160)pi^(-136) + pi^(-137), inner-simplified00x^n ((1 - d^2)/x - x)^3 (1 + x^2 - d x)/(x - d)/pi^2, simplified0 provided ...0 provided ...What changes. Evaluation rounds a value within
1e-50of an integer onto the integer, half the default hundred digits, which is what makes the residual of a cancellation --sin(pi)'s,sqrt(2)^2 - 2's -- the zero it is; and inner simplification takes a node's value wherever that value is an exact number. A product cancels nothing, so a zero there is rounding alone:1/pi^136evaluated to0, and that0was taken as its value. The shortcut passes over such a zero now where the node is a product, a quotient or a power of numbers and constants none of which is zero, or a sum of such of one sign, and the node is kept as written. Evaluation is unchanged:"1/pi^136".EvalNumerical()is0as before, the rounding being the setting's.Where it showed. The integrator simplifies an integrand under a substitution, and answered
e x^n (((a e f^2 - d^2 e)/(e x) - x)/2 + x)^3 (4 x (x - d) - 2 ((x - d)^2 - a f^2))/(f^3 (2 e x)^2), with Euler'se, as0. The derivation of the last row'sSimplifyreaches(pi^136)^(-1), and its value is lost at that node's inner simplification.Tests:
PowerOfAConstantBelowTheToleranceTest: six expressions not rounded to zero, compared exactly with a rational for each constant; two cancellations still zero; andSimplifykeeping the last row's value at a point. On master eight of its ten fail.The full suite on the head,
f1f8bfee, passes, 14,934 tests, and the allocation gate passed on the change; the library builds fornetstandard2.0. The head is one commit on master85d6601c.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura