brython-dev / brython

Brython (Browser Python) is an implementation of Python 3 running in the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serious string formatting error with floats

stroobandt opened this issue · comments

In the online Brython console, type the following statement:

'%.*E' % (1, 0.9999)

It yields: '1.0E-02'

Doing the same in ipython (v3.8.10) yields the correct answer, which is of course: '1.0E+00'

This error will seriously upset scientific results and should receive priority attention from the debugging team!

Another example:

float('%.3g' % 9.99999e-06)

Brython yields: 1e-07

Whereas iPython correctly yields: 10E-6

Thanks for the report @stroobandt !