Skip to content

feat(GG-3824): Add LogBase and explicit errors for impossible calculations - #3

Open
yohanpainchaud-gg wants to merge 1 commit into
ci/GG-3824-python-3.14from
feature/GG-3824
Open

yohanpainchaud-gg wants to merge 1 commit into
ci/GG-3824-python-3.14from
feature/GG-3824

Conversation

@yohanpainchaud-gg

@yohanpainchaud-gg yohanpainchaud-gg commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Niveau : critique — moteur de calcul des résultats diagnostiques (SOUP)
Contrat : https://app.clickup.com/t/1240ccep35e
Version paquet 1.14.0.post5, tag à publier 1.10.0-5. Basée sur la PR de CI.

Ce qui change

  • Nouvelle opération ["LogBase", x, b], exacte en bases 10 et 2 ; ["Log", x] reste un ln.
  • Erreurs dédiées et exportées : domaine, dépassement, sous-dépassement, opération non supportée (strict).
  • Plus aucun résultat complexe ; racine impaire d'un négatif réelle : Root(-8, 3) = −2.
  • Un inf ou NaN venu des paramètres se propage sans erreur ; seuls des opérandes finis déclenchent.
  • If et Map laissent passer ces erreurs : If sur Log10(0) n'emprunte plus la branche « sinon ».

Échecs couverts

Cas Résultat Test
Log10(0), Ln(0), LogBase(10, 1), Sqrt(-4), Root(-16, 4), Power(-8, 0.5) MathJSONDomainError test_domain_error
Root(-8, 3), LogBase(8, 2), LogBase(1000, 10) −2, 3, 3 exacts test_calculator_operations
Power(10, 400), Exp(1000), Multiply(1e300, 1e300) MathJSONOverflowError test_overflow_error
Power(10, -400), Exp(-1000) MathJSONUnderflowError test_underflow_error
inf venu des données × 100 < 50 Faux test_non_finite_data_go_through
Floor, Sin en strict MathJSONUnsupportedOperator test_unsupported_operator_raises_in_strict_mode
Liste de paramètre, y compris via Constants ou le contexte, en strict rendue telle quelle test_list_parameters_are_data_in_strict_mode
Nouvelle erreur dans If ou Map propagée test_if_and_map_let_calculation_errors_through
Power(2, 3), Switch sur une puissance entier 8 test_integer_power_stays_an_integer

Lire dans cet ordre

  1. src/mathjson_solver/__main__.py — power, root, log_base, finite, puis les opérateurs et If/Map
  2. tests/test_with_pytest.py — scénarios du contrat et non-régression
  3. CHANGELOG.md — changements de comportement à connaître côté back
  4. README.md — erreurs et mode strict
Preuves de revue

REVIEW_GATE: NEEDS_HUMAN
SCOPE: ci/GG-3824-python-3.14...feature/GG-3824
REVIEWERS: delivery-auditor, change-reviewer, finding-verifier
CHECKS: git diff --check : OK ; python -m pytest -q tests : 346 passed ; suite dpcr-back (837 tests) avec ce solver installé : 837 passed
REASON: fiche SOUP et SBOM de la nouvelle version à mettre à jour hors du dépôt ; classement des nouvelles erreurs côté back (GG-3825) à livrer avec la montée de version

🤖 Generated with Claude Code

…tions

- ["LogBase", x, b]: logarithm in base b, exact for bases 10 and 2.
  ["Log", x] stays the natural logarithm, whatever its base.
- MathJSONDomainError: logarithm of a number <= 0, base <= 0 or equal
  to 1, even or fractional root of a negative number, power of a
  negative number with a non-integer exponent. No complex result any
  more; an odd root of a negative number is real.
- MathJSONOverflowError / MathJSONUnderflowError: finite operands
  giving a non-finite, too large or too small (0.0) result. Infinite
  and NaN values coming from the parameters raise neither.
- MathJSONUnsupportedOperator: in strict mode, a formula whose operator
  is unknown. Lists given as parameter values stay data.
- If and Map let these errors through instead of swallowing them.
- Power of integers still gives an integer.

Package version 1.14.0.post5, for tag 1.10.0-5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yohanpainchaud-gg yohanpainchaud-gg changed the title Base-10 Log and out-of-domain errors feat(GG-3824): Add LogBase and explicit errors for impossible calculations Nov 25, 2026
@yohanpainchaud-gg
yohanpainchaud-gg changed the base branch from main to ci/GG-3824-python-3.14 November 25, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant