[Qt-interest] QVariant imprecision?

Mario Signorino mario.signorino at gmail.com
Tue Feb 16 14:26:49 CET 2010


Hi all.

The code:

    double doubleFrom = 99999.99;
    QVariant var(doubleFrom);
    double doubleTo = var.toDouble();
    qDebug() <<"doubleTo"<< doubleTo;
    qDebug() <<"todouble"<< var.toDouble();
    qDebug() <<"tostring"<< var.toString();
    qDebug() <<"tofloat"<< var.toFloat();

The output  (Qt 4.6.0 OpenSource):

    doubleTo 100000
    todouble 100000
    tostring "99999.99"
    tofloat 100000

What?
Am I missing something?


-- 
Mario Signorino | www.sgrunt.net



More information about the Qt-interest-old mailing list