Skip to content

Numeric_Literals

Christoffer Fink edited this page Jun 4, 2014 · 1 revision

Numeric literals are simply strings of digits. Floating point values are expressed using a dot (.). Leading zeros are optional. No spaces, letters or other special characters are allowed. The rules could be compactly described by a regular expression:

    [0-9]*\.?[0-9]+

Examples

  • 123
  • 3.14
  • .5

Suggestions for Future Versions

Allow underscores within numbers to group digits to increase readability for large numbers. For example, 1 MB could be expressed as the string "1_048_576".

Allow scientific notation, such as 5.23e12.

Clone this wiki locally