?Why is 0e-6 invalid?
dsh8290 at rit.edu
Fri Dec 22 05:47:32 CET 2000
I think that it is illegal in Scientific notation (I presume that is
what you want).
AFIAK scientific notation is [1-9]e-?[0-9]+
(a 1 thru 9 followed by e followed by optional negative sign followed
by any sequence of 0 thru 9)
On Thu, Dec 21, 2000 at 04:04:28PM -0700, Norman Shelley wrote:
> Why is 0e-6 invalid and 0*.000001 is valid?
> They are equivalent and a "normal" mathematically trained individual
> sees them for what they are immediately.
> (I have a trivial engineering notation to number convertor that takes
> "0u" or "5u" and converts them to "0e-6" and "5e-6" and then evaluates
> them. The later works fine, the former fails. Granted I could check for
> this condition, but it seems that the Python evaluator should be able to
> work on this boundary case as it still consistent.)
> >>> 0*.000001
> >>> 1e-6
> >>> 0e-6
> File "<stdin>", line 1
> SyntaxError: invalid syntax
More information about the Python-list