-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix and improve float formatting #1309
Conversation
bc4a551
to
025cbb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
I added a rewrite pass that adds a leading |
12e+34
into 12e + 34
3.539537889086625e24000, | ||
3539537889086624823140625, | ||
0x123, | ||
0xE45, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this E
also be lowercased?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or this is invalid and just left as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
12e+34
is no longer broken into12e + 34
.Also adds a rewrite pass that turns e.g.
.23E+021
into0.23e21
:+
s and0
s from the exponentE