-
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 based floating point literals #9106
base: master
Are you sure you want to change the base?
Conversation
CT Test Results 2 files 96 suites 1h 13m 13s ⏱️ Results for commit 0afd8d0. ♻️ 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
If you write an EEP soon, I think it is still possible that we could include this improvement in OTP 28. |
I was waiting to hear which form the OTP team favours. The Ada style, or the frankenstyle? |
OK. I'll try to find out what the team thinks. I've posted a question in our internal forums. Personally I think we should go for the Ada style. |
I agree; the # before the exponent makes it clear that the next letter is never part of the mantissa. The C99 form relies on p not being in the allowed a-f, but with the Ada form, Erlang could just accept any base that it already allows for integers. |
EEP PR: erlang/eep#71 |
I've got two comments so far; both prefer the Ada style. |
Good; that's what I put in the EEP draft. Just need to update the code to match. |
Follows Ada style, e.g. 16#ff.fe#e-2, 2#0.101#e5, etc.
The code now uses Ada style, i.e. |
Similar to based float literals in Ada and hex float literals in C 99, using Erlang's Base#Literal notation (inspired by Ada), for example, 2#0.10101#e8, or 16#fefe.fefe#e-16. The # before the exponent is required. 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.
Currently missing: documentation, io formatting, list_to_float/2 implementation.
Based on #9104, which improves pinpointing of errors in numerical literals.