Integers in KLocale::readNumber() ?

Thiago Macieira thiago at kde.org
Mon Feb 13 08:58:59 GMT 2006


Alfredo Beaumont wrote:
>I need to distinguish between integer and FP numbers, but
>KLocale::readNumber() only provides a double, even if the string
> contains an integer. Which would be the best way to solve this problem?
> Should KLocale API be changed?

Convert your double to int and you'll have an integer. If the difference 
between the converted int and the original double is larger than a 
certain epsilon, the string didn't contain an integer.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

3. Ac seo woruld wearð geborod, swá se Scieppend cwæð "Gewurde Unix" and 
wundor fremede and him "Unix" genemned, þæt is se rihtendgesamnung.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060213/1d358e40/attachment.sig>


More information about the kde-core-devel mailing list