Repository navigation
Base-10 Log and out-of-domain errors - #3
Open
yohanpainchaud-gg wants to merge 4 commits into
Open
yohanpainchaud-gg wants to merge 4 commits into
yohanpainchaud-gg wants to merge 4 commits into
Conversation
BREAKING CHANGE: ["Log", x] is now the base-10 logarithm, as in the CortexJS Compute Engine used by the front end. Consumers must migrate stored ["Log", x] expressions to ["Ln", x] to keep the previous result. - ["Log", x, b] computes the logarithm in base b - MathJSONDomainError (a ValueError) for logarithms of non-positive numbers, invalid bases, square or even roots of negative numbers and negative bases raised to non-integer powers - odd roots of negative numbers are real (["Root", -8, 3] is -2) - OverflowError is caught, and inf or nan results raise - ExponentialE constant; parameters with the same name take precedence - optional strict mode raising on unknown operators (off by default) - version 1.10.0-4, Python >= 3.11, CI on Python 3.11 and 3.14 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tags 1.10.0-2 and 1.10.0-3 already declare version 1.14.0 (upstream 1.14.0 was merged before them). Declaring 1.10.0-4 (1.10.0.post4 for pip) would make the installed version go down; 1.14.0.post4 keeps it increasing. The tag stays 1.10.0-4. The CHANGELOG records the tag / version mapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
glibc's cbrt is not correctly rounded: cbrt(27) is 3.0000000000000004, so ["Root", 27, 3] and ["Root", -27, 3] failed the reference tests in CI, and would compute the same off-by-one-ulp values in production (Linux), where Windows' cbrt gives 3.0. A root with a positive integer index now returns the nearest integer when its power gives x back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rounding a NaN root raised a bare ValueError, which the back classifies as a generic error instead of a domain error, and rounding an infinite one changed the overflow message. Only finite roots are rounded now. Also pins the exact-root rounding on the pow path (n != 3), which was only tested through cbrt. 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.
Niveau : critique — moteur de calcul des règles de résultats diagnostiques dPCR
Contrat : https://app.clickup.com/t/1240ccep35e
Ce qui change
["Log", x]calcule log₁₀ (avant : ln) ;["Log", x, b]respecte enfin la base.MathJSONDomainError.infsilencieux.cbrt(27)= 3.0000000000000004).À juger
1.14.0.post4pour le tag1.10.0-4: les tags précédents déclarent déjà 1.14.0.["Log", x, 10]passe parmath.log(x, 10): -2.9999999999999996 au lieu de -3.0 (\lgle produit).Power/Root/Sqrtviamath.pow: résultats toujours flottants (Power(2,3)= 8.0).Root(0, n<0)lève une erreur de domaine, alors quePower(0, -1)lève une division par zéro.1.10.0-4doit viser1ec1b9c; la PR dPCR-back en dépend.Échecs couverts
MathJSONDomainErrortest_raises_domain_and_overflowMathJSONDomainErrortest_raises_domain_and_overflowMathJSONException(OverflowError)test_raises_domain_and_overflowMathJSONException(NotImplementedError)test_unknown_head_stricttest_solver_log_power_rootcbrtdécalé d'un ulp (glibc)test_root_is_exact_when_cbrt_is_one_ulp_offpow(x, 1/n)décalé d'un ulp (n ≠ 3)test_root_is_exact_when_pow_is_one_ulp_offMathJSONDomainError/OverflowErrortest_root_of_a_non_finite_valueLire dans cet ordre
src/mathjson_solver/__main__.py— Log, Root et racines exactes, finitude, mode stricttests/test_with_pytest.py— valeurs de référence et erreursCHANGELOG.md— correspondance tag / version du paquetPreuves de revue
REVIEW_GATE: NEEDS_HUMAN
SCOPE: origin/main...feature/GG-3824
REVIEWERS: delivery-auditor, change-reviewer, finding-verifier
CHECKS: git diff --check : OK ; pytest tests Windows (Python 3.14.5) : 264 passed ; pytest tests Linux glibc 2.41 (Python 3.14) : 264 passed ; test NaN en échec sur 3451f68 (prouve le correctif)
REASON: tag 1.10.0-4 non publié ; fiche SOUP/SBOM absente ; non-régression prod non faite
🤖 Generated with Claude Code