[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QLocale.toString() with great numbers.
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2016-08-23 17:20:49
Message-ID: C34F4ECE-C34A-4847-ABC3-A6E2CF4ED8BB () riverbankcomputing ! com
[Download RAW message or body]
On 23 Aug 2016, at 11:31 am, Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> \
wrote:
>
> Hi,
>
> I want to display a number with the locale conventions, then I use QLocale.toString \
> for that but with some great numbers I get strange results.
> Python 3.4.3 (default, Oct 14 2015, 20:28:29)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> > > > from PyQt5.QtCore import QLocale
> > > > loc = QLocale.system().name()
> > > > lang = QLocale(loc)
> > > > lang.toString(1000000000)
> '1.000.000.000'
> > > > lang.toString(2000000000)
> '2.000.000.000'
> > > > lang.toString(5315035136)
> '1.020.067.840'
>
> Same with PyQt4
>
> Python 2.7.6 (default, Jun 22 2015, 17:58:13)
> [GCC 4.8.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> > > > from PyQt4.QtCore import QLocale
> > > > lang = QLocale(QLocale.system().name())
> > > > lang.toString(2100000000)
> PyQt4.QtCore.QString(u'2.100.000.000')
> > > > lang.toString(2315035136)
> PyQt4.QtCore.QString(u'-1.979.932.160')
> > > > lang.toString(5315035136)
> PyQt4.QtCore.QString(u'1.020.067.840')
>
>
> This behaviour appears for the values up to 2,100,000,000.
> Theses examples are on a 64 bits machine, on a 32 bits the return for great value \
> is always -1.
> Is it a question of int versus long number?
Should be fixed in tonight's snapshot. I don't plan to change PyQt4.
Thanks,
Phil
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic