Skip to content

Numeric answers with a very small or very large mantissa and an exponent are not parsed by extract_value #6228

Closed

Description

@rtibblesbot

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: unstable

Observed behavior

parser.extract_value returns None for exponent-form numbers whose mantissa's Python repr uses exponent notation, i.e. < 1e-4 or >= 1e16.

  • 0.00001e5 → None (mantissa 1e-05 builds eval("1e-05e5"), a SyntaxError swallowed as None)
  • 12345678901234567e2 → None
  • 100000000000000000000E-19 → None

0.0001e5 and 1e-5 parse. All of the above are valid finite xsd:double values (#6150).

Expected behavior

Any finite exponent-form number the pattern accepts parses to its value.

User-facing consequences

Steps to reproduce

  1. from contentcuration.utils.parser import extract_value
  2. extract_value("0.00001e5") → None; expected 1.0.

Context

AI usage

Found while reviewing the #6224 branch with Claude Code; reproduced by running extract_value on both upstream/unstable and the branch.

Activity

  1. added theissue type on Sep 30, 2026
  2. self-assigned this
    on Sep 30, 2026
  3. rtibblesbot commented on Sep 30, 2026

    @rtibblesbot
    ContributorAuthor

    Plan: extract_value parses every finite exponent-form number EXPONENT accepts, including mantissas whose repr uses exponent notation.

    • Parse extreme-mantissa exponents without eval
    • /simplify pass and self-review

    Assumptions — the issue did not settle these; say so if one is wrong.


    @rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

    How was this generated?
    • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
    • Ran the project's full test suite and linter before committing
    • For UI changes: captured live screenshots to verify rendering
    • For backend changes: verified with example API/CLI output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions