lean4
lean4 copied to clipboard
Unusual Float parsing
Prerequisites
- [x] Put an X between the brackets on this line if you have done all of the following:
- Checked that your issue isn't already filed.
- Reduced the issue to a self-contained, reproducible test case.
Description
The parsing of Float literals in Lean is somewhat unusual compared to other popular languages which might lead to unexpected behaviour.
Steps to Reproduce
#eval 1.0e -- 1.000000
#eval 1.0e+1 -- 2.000000
Expected behavior:
- I expect
1.0eto be an error.eshould always have to be followed by a number. - I expect
1.0e+1to parse as10.0just like it does in JavaScript, Java, C++, and Python.
Actual behavior: 1.0e is a valid Float literal and 1.0e+1 gets parsed as (1.0e) + (1) which is 2.0.
Reproduces how often: 100%
Versions
Lean v4.0.0-m5 (commit 7dbfaf9) on Ubuntu 20.04.