Parse exponent-form numbers with extreme mantissas - #6233
Merged
Merged
Conversation
rtibblesbot
marked this pull request as ready for review
September 30, 2026 17:24
rtibblesbot
force-pushed
the
issue-6228-f5c20f
branch
2 times, most recently
from
September 30, 2026 17:40
5ea4d64 to
2506386
Compare
rtibbles
reviewed
Sep 30, 2026
rtibbles
left a comment
Member
There was a problem hiding this comment.
One question about conflicting updates.
| (r"0\.0025", 0.0025), | ||
| (r"-4\.5%", -0.045), | ||
| (r"2\.3e10", 2.3e10), | ||
| ("0.00001e5", 1.0), |
Member
There was a problem hiding this comment.
This feels redundant with this? #6209
Once the above is merged, will we even need this parser any more?
Contributor
Author
There was a problem hiding this comment.
Not redundant: #6209 doesn't replace utils/parser.py. Its new code imports extract_value from it (searched the #6209 diff: 1 import, 1 call). Non-test callers on this branch: perseus.py:78 and parser.py itself (parse_exponent, percent parsing) — 3 places, all use the fixed parse_exponent. So extract_value stays after #6209 and these rows still test it. No changes made.
rtibblesbot
force-pushed
the
issue-6228-f5c20f
branch
from
September 30, 2026 20:02
2506386 to
221c4d1
Compare
Build the number with float() on the assembled string instead of eval on str(float), so mantissas beyond double range parse. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
rtibblesbot
force-pushed
the
issue-6228-f5c20f
branch
from
September 30, 2026 20:19
221c4d1 to
188e991
Compare
rtibbles
approved these changes
Oct 2, 2026
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.
Summary
extract_valuereturnedNonefor exponent-form numbers whose mantissarepruses exponent notation (0.00001e5,12345678901234567e2), dropping those answers in_process_input_answers.parse_exponentcallsfloat()on the{mantissa}e{exp}string instead ofevalon a string built fromstr(float).number_parser.jsexists here, so there is no JS side.Closes #6228
References
extract_value#6224, [QTI] Tracking issue -- UX enhancements #6103Reviewer guidance
1e400) still returnsinf, as before; noisfiniteguard was added. Add one ifNoneis wanted.1e-400) stays0.0; add a zero-result check if it should beNone.e; if Older-Kolibri Perseus export drops QTI Text entry items whose numeric answers are valid xsd:double but not parseable byextract_value#6224 lands first, add uppercase rows.AI usage
Implemented with Claude Code using TDD; new rows were run red against the old parser first. I reviewed the diff and ran
test_parser.py.🤖 Generated with Claude Code
Committed separately: no commit on this branch introduced the lines these changes touch, so they are a new commit rather than folded into the work they amend:
contentcuration/contentcuration/utils/parser.py@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
🟡 Waiting for feedback
Last updated: 2026-09-30 20:20 UTC