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


let double = 1.0 as Double  // Double precision
let float = 1.0 as Float // Single precision
let scientific = 1.0E-12
 
// Swift does not feature type coercion for explicit type declaration
let sum = double + float // Error
 
let div = 1.1 / 2 // Double
let div1 = 1 / 2 // 0