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


put 0.23
-- 0.2300
 
-- activate higher printing precision
the floatPrecision = 8
 
put -.23
-- -0.23000000
 
put 9.00719925474099e15
-- 9.00719925474099e15
 
-- result is NOT a float
put 2/3
-- 0
 
-- casting integer to float
put float(2)/3
-- 0.66666667
 
-- casting string to float
put float("0.23")
-- 0.23000000