Info Node: (python2.1-ref.info)Floating point literals
(python2.1-ref.info)Floating point literals
Floating point literals
-----------------------
Floating point literals are described by the following lexical
definitions:
floatnumber: pointfloat | exponentfloat
pointfloat: [intpart] fraction | intpart "."
exponentfloat: (nonzerodigit digit* | pointfloat) exponent
intpart: nonzerodigit digit* | "0"
fraction: "." digit+
exponent: ("e"|"E") ["+"|"-"] digit+
Note that the integer part of a floating point number cannot look like
an octal integer, though the exponent may look like an octal literal
but will always be interpreted using radix 10. For example, `1e010' is
legal, while `07.1' is a syntax error. The allowed range of floating
point literals is implementation-dependent. Some examples of floating
point literals:
3.14 10. .001 1e100 3.14e-10
Note that numeric literals do not include a sign; a phrase like `-1' is
actually an expression composed of the operator `-' and the literal `1'.