For the PySide what is really happening is not a rounding error/precision as 
suggested, but printing an integer with floating point notation. When the 
floating point is converted to an integer it is rounded. To satisfy yourself 
that this is in fact happening change the number to be printed (e.g., 9999999.5 
vs 9999999.4).

I'm not really conversant with PySide, but from 
http://srinikom.github.io/pyside-docs/PySide/QtCore/QLocale.html it appears 
that there is no floating point version of the toString() function, just 
integer, date, and dateTime. As Qt has a variety of floating point overloads 
for that function (https://qt-project.org/doc/qt-4.8/qlocale.html#toString) it 
would look to me like a bug/oversight on the part of the PySide implementation.

Tim Doty

On Apr 14, 2013, at 5:03 AM, Alexey Vihorev <[email protected]> wrote:

> Hi!
> 1.  from PySide.QtCore import QLocale as PySideLocale #PySide 1.1.2 on Win32
> 2.  from PyQt4.QtCore import QLocale as PyQtLocale
> 3.   
> 4.  print(PySideLocale().toString(9999999.99, 'f', 2)) #prints '10 000 000,00'
> 5.  print(PyQtLocale().toString(9999999.99, 'f', 2)) #prints '9 999 999,99'
> I guess it’s a bug, right?
>  
> _______________________________________________
> PySide mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/pyside

_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside

Reply via email to