Fix exponential notation for numbers not ending with zeros (issue #236)#237
Closed
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Closed
Fix exponential notation for numbers not ending with zeros (issue #236)#237devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Conversation
- Add endswith check to only convert numbers to exponential notation if they end with enough zeros (based on exponential_threshold) - Add validation to reject exponential_threshold < 1 - Add tests for the fix and validation Co-Authored-By: Yuya Sugie <y.sugie.15739d@gmail.com>
Contributor
Author
Original prompt from Yuya |
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Yuya Sugie <y.sugie.15739d@gmail.com>
Contributor
Author
|
Closing due to inactivity for more than 7 days. Configure here. |
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
Fixes #236 where numbers like 998244353 were incorrectly being converted to exponential notation (e.g., "9.98244353 × 10^8").
The fix adds an additional condition to the exponential notation conversion: numbers are only converted if they end with enough trailing zeros based on the
exponential_thresholdsetting. For the default threshold of 1000000, numbers must end with at least 6 zeros to be converted.Changes:
to_string()invariables_converter.pyto check that numbers end withthreshold_kzeros (where10^threshold_k >= exponential_threshold)StatementConfigto rejectexponential_threshold < 1Review & Testing Checklist for Human
exponential_threshold = 1: When threshold is 1,threshold_k = 0, soendswith("")is always True. This means all numbers >= 1 would be converted to exponential notation. Confirm this is acceptable behavior.ss-manageron existing problem sets that use constraints likeMOD = 998244353to verify they now display correctly as "998,244,353" instead of exponential notation.Recommended test plan:
MOD998 = 998_244_353andLARGE_CLEAN = 10_000_000ss-manager runand verify MOD998 displays as998{,}244{,}353(not exponential) and LARGE_CLEAN displays as10^{7}(exponential)Notes