Skip to content

reject digit separator inside hex-float exponents - #302

Open
Ramya-9353 wants to merge 1 commit into
google:masterfrom
Ramya-9353:hex-float-exponent-separator
Open

reject digit separator inside hex-float exponents#302
Ramya-9353 wants to merge 1 commit into
google:masterfrom
Ramya-9353:hex-float-exponent-separator

Conversation

@Ramya-9353

Copy link
Copy Markdown
Contributor

Repro: with a digit separator set and ALLOW_HEX_FLOATS, "0x1p1_0" parses to 1024 and "0x1.8p1_0" to 1536; both should be junk.
Cause: IsHexFloatString and RadixStringToIeee advance through the hex-float exponent with the active separator, so a separator between two exponent digits is consumed. The decimal exponent uses a plain increment and already rejects "1e1_0".
Fix: advance through the hex-float exponent with kNoSeparator in both the validator and the parser, matching the documented rule that the separator is only allowed between significand digits. Significand separators and valid hex-floats are unchanged; a regression test sits beside the existing separator cases.

@google-cla

google-cla Bot commented Aug 8, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant