Programming languages have different ways of expressing floating-point literals.



Task

Show how floating-point literals can be expressed in your language: decimal or other bases, exponential notation, and any other special features.

You may want to include a regular expression or BNF/ABNF/EBNF defining allowable formats for your language.



Related tasks

   Literals/Integer
   Extreme floating point values


iex(180)> 0.123
0.123
iex(181)> -123.4
-123.4
iex(182)> 1.23e4
1.23e4
iex(183)> 1.2e-3
0.0012
iex(184)> 1.23E4
1.23e4
iex(185)> 10_000.0
1.0e4
iex(186)> .5
** (SyntaxError) iex:186: syntax error before: '.'
 
iex(186)> 2. + 3
** (CompileError) iex:186: invalid call 2.+(3)
 
iex(187)> 1e4
** (SyntaxError) iex:187: syntax error before: e4