Fix and improve float formatting#1309
Merged
vladmos merged 4 commits intobazelbuild:mainfrom Jan 14, 2025
Merged
Conversation
bc4a551 to
025cbb6
Compare
vladmos
reviewed
Nov 27, 2024
vladmos
reviewed
Nov 27, 2024
Member
vladmos
left a comment
There was a problem hiding this comment.
Do I understand it correctly that it allows some invalid expressions like 1e2e3 or 1.2e3.4? Not insisting that it should be fixed here, maybe it's actually better to format the rest than fail.
Contributor
Author
|
I added a rewrite pass that adds a leading |
12e+34 into 12e + 34
vladmos
reviewed
Jan 10, 2025
| 3.539537889086625e24000, | ||
| 3539537889086624823140625, | ||
| 0x123, | ||
| 0xE45, |
Member
There was a problem hiding this comment.
Shouldn't this E also be lowercased?
Member
There was a problem hiding this comment.
Or this is invalid and just left as is?
Contributor
Author
There was a problem hiding this comment.
This is not a float, but a hex number. We could discuss whether hex literals should be canonicalized in some way, but I would prefer to handle that in a separate PR.
vladmos
approved these changes
Jan 14, 2025
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.
12e+34is no longer broken into12e + 34.Also adds a rewrite pass that turns e.g.
.23E+021into0.23e21:+s and0s from the exponentE