-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Make scanner accept floating point literals in hex and binary #9106
base: master
Are you sure you want to change the base?
Conversation
CT Test Results 2 files 96 suites 1h 7m 37s ⏱️ Results for commit 28ad2e8. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
5760563
to
637b7fc
Compare
Rebased on #9104 after squashing. |
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.
Looks good to me. We do need an EEP for any changes to the language.
I'm seeing now that in Ada, which is where Erlang got its |
44f63f1
to
28ad2e8
Compare
Similar to hex float literals in C 99, but using Erlang's Base#Literal notation we can easily have binary as well. For example, 2#0.10101p8, or 16#fefe.fefep-16. The letter p (as in C99) stands for powers of 2. The exponent, like the base, is always a decimal number.
These can be useful for code generators and other cases where you want to preserve an exact bit representation of a float.
Also allows explicit base 10 for completeness, as in 10#123.345e9 (with the letter e for exponent as normal - p not allowed, since it would make it very easy to miss whether it is a power of 2 or 10).
Currently missing: documentation. Might also need an EEP.
Based on #9104, which improves pinpointing of errors in numerical literals.