Skip to content

Fix exponential notation for numbers not ending with zeros (issue #236)#237

Closed
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1768009888-fix-exponential-notation
Closed

Fix exponential notation for numbers not ending with zeros (issue #236)#237
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1768009888-fix-exponential-notation

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Jan 10, 2026

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_threshold setting. For the default threshold of 1000000, numbers must end with at least 6 zeros to be converted.

Changes:

  • Modified to_string() in variables_converter.py to check that numbers end with threshold_k zeros (where 10^threshold_k >= exponential_threshold)
  • Added validation in StatementConfig to reject exponential_threshold < 1
  • Added tests for the fix and validation

Review & Testing Checklist for Human

  • Verify edge case with exponential_threshold = 1: When threshold is 1, threshold_k = 0, so endswith("") is always True. This means all numbers >= 1 would be converted to exponential notation. Confirm this is acceptable behavior.
  • Test with real problem.toml files: Run ss-manager on existing problem sets that use constraints like MOD = 998244353 to verify they now display correctly as "998,244,353" instead of exponential notation.
  • Verify the logic matches issue discussion: The approach was agreed upon in issue 998244353 が 9.98244353 × 10^8 になる #236 comments - confirm the implementation matches the expected behavior.

Recommended test plan:

  1. Create a problem.toml with MOD998 = 998_244_353 and LARGE_CLEAN = 10_000_000
  2. Run ss-manager run and verify MOD998 displays as 998{,}244{,}353 (not exponential) and LARGE_CLEAN displays as 10^{7} (exponential)

Notes

- 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>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Original prompt from Yuya
Received message in Slack channel #tech:

@Devin statements-manager の issue 236 をやってください
アプローチが何通りか考えられるので、まずどのような方針でやろうとしてるか教えてください
Thread URL: https://tsutaj-playground.slack.com/archives/C02EUD46XS9/p1768009432958019

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: Yuya Sugie <y.sugie.15739d@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Closing due to inactivity for more than 7 days. Configure here.

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.

998244353 が 9.98244353 × 10^8 になる

1 participant