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


 
Def ExpType$(x)=Type$(x)
Print ExpType$(-12)="Double", -12
Print ExpType$(12.)="Double", 12.
Print ExpType$(12.e-5)="Double", 12.e-5
Print ExpType$(.1)="Double", .1
Print ExpType$(-12~)="Single", -12~
Print ExpType$(12.~)="Single", 12.~
Print ExpType$(12.e-5~)="Single", 12.e-5~
Print ExpType$(.1~)="Single", .1~
 