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


1. //Double equal to 1.0
1.0 //Double, a 64-bit IEEE-754 floating point number (equivalent to Java's double primitive type) 
2432311.7567374 //Double
1.234E-10 //Double
1.234e-10 //Double
758832d //Double
728832f //32-bit IEEE-754 floating point number (equivalent to Java's float primitive type)
1.0f //Float
758832D //Double
728832F //Float
1.0F //Float
1 / 2. //Double
1 / 2 //Int equal to 0
 
// Constants
Float.MinPositiveValue
Float.NaN
Float.PositiveInfinity
Float.NegativeInfinity
 
Double.MinPositiveValue
Double.NaN
Double.PositiveInfinity
Double.NegativeInfinity
 