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


/* Maxima has machine floating point (usually double precision IEEE 754), and
arbitrary length "big floats" */
 
/* Here are ordinary floats */
3.14159
2.718e0
1.2345d10
1.2345e10
1.2345f10
 
/* And big floats (always with a "b" for the exponent) */
3.14159b0
2.718b0
1.2345b10
 
/* Before computing with big float, one must set precision to some value (default is 16 decimal digits) */
fpprec: 40$
 
bfloat(%pi);
3.141592653589793238462643383279502884197b0