Skip to content

Conversation

@jaja360
Copy link
Collaborator

@jaja360 jaja360 commented Jun 27, 2025

This PR improves the optimize_number_string function by removing unnecessary '+' signs in the exponent of numbers formatted in scientific notation.

Context: std::to_chars always includes a sign in the exponent when formatting in scientific notation (e.g., 1.23e+04), and we should strip it.

This PR ensures that such cases are normalized. For example:

optimize_number_string("1.23e+04")  // now returns "1.23e4"

Additional minor changes:

  • Restricted the scope of some variables
  • Cleaned up indentation and uniformized the style for consistency.

"1.23e+004" now becomes "1.23e4" instead of staying the same
@jaja360 jaja360 requested a review from lemire June 27, 2025 04:58
@lemire
Copy link
Member

lemire commented Jun 27, 2025

Love it.

Copy link
Member

@lemire lemire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are brilliant !!!

❤️

@jaja360 jaja360 merged commit 0490d8b into produce_shortest Jun 27, 2025
8 checks passed
@jaja360 jaja360 deleted the fix_shortest branch June 27, 2025 18:49
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.

3 participants