Repository navigation
A constant is worth the current precision's digits, and a cached evaluation is recomputed when the precision context has changed - #1368
Merged
Conversation
…uation is recomputed when the precision context has changed pi and e were worth the digits of whichever precision context was set when Variable.ConstantList was built, and an entity's cached Evaled survived a change of MathS.Settings.DecimalPrecisionContext: pi at three hundred digits after an evaluation at a hundred came back with a hundred, and e^x at three hundred came back correct to a hundred, since its base no longer equalled the cache's e and the power fell to a logarithm of the hundred-digit base and an exponential. A held expression evaluated at a hundred digits and again at five hundred answered from the first. The constant's value is looked up at the moment of evaluation now, and the precision setting advances an evaluation epoch on every Set and on every scope's end, which an entity records beside its Evaled and compares on each read, so a cached evaluation under another precision is recomputed. One int per entity and one static read per evaluation; the gate's allocation rows move by 0.1 to 1.0 per cent, inside its band, and the baseline stands. The performance log has the entry. Four suites green (11,349 / 134 / 18 / 41). Closes #1367. Part of #1338. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Rafael-SOWNet
added a commit
that referenced
this pull request
Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Rafael-SOWNet
added a commit
that referenced
this pull request
Oct 9, 2026
* Breaking-changes entries for #1828 to #1832 and #1374 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura * And for #1368, #1611 and #1517, each measured on 2.5.0 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura * And for #1289, #1312, #1315, #1377, #1380 and #1371, each measured on 2.5.0 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura --------- Co-authored-by: Claude Opus 5.5 (1M context) <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.
Fixes #1367:
piandewere worth the digits of whichever precision context was set whenVariable.ConstantListwas built, and an entity's cachedEvaledsurvived a change ofMathS.Settings.DecimalPrecisionContext. Sopiat 300 digits after an evaluation at 100 came back with 100,e^xat 300 came back correct to 100 (its base no longer equalled the cache'se, soPowfell from "the exponential of the power" to a logarithm of the 100-digit base and an exponential), and a held expression evaluated at 100 digits and again at 500 answered from the first.Two changes:
ConstantListmaps a name toFunc<Complex>—() => MathS.DecimalConst.pi— soConstant.Valueis the current context's digits every time. The registry's shape (a name is a constant exactly when it is a key) is unchanged.Convenience.EvaluationEpoch, a static counter): the precision setting advances it on everySetand on every scope'sDispose(aSetting<T>opts in withAdvancesEvaluationEpoch, and onlyDecimalPrecisionContextdoes).Entity.Evaledrecords the epoch it was computed at beside its lazy slot and resets the slot when it has moved. The counter is one for every thread — settings areAsyncLocal, so a change on another flow costs a recomputation there, never a stale value.Cost: one
intper entity and one volatile read perEvaled. The gate's allocation rows move by +0.1% to +1.0% (8 bytes × the entities a row builds), all inside its band, so the baseline stands; time flat. The performance log has the entry (the 2075th).Tests:
ConstantsAndCachedEvaluationsFollowThePrecision(pi and a heldsin 1 + piat 100 → 300 → 100 digits, the 300-digit pi pinned against mpmath) andEToAPowerAtAHigherPrecisionAfterALowerOne(300 digits ofe^0.37000000000001234pinned against mpmath); both fail on master.Four suites green (11,349 / 134 / 18 / 41).
Part of #1338.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura