Reputation: 379
I want to change text into float number for calculation in Qt
float test = ui.tableWidget->item(0, 1)->text().replace(",", ".", Qt::CaseSensitive).toFloat();
when I type 2.86, actually I see test = 2.85999990
in debug. How can I receive correctly what i typed ?
I can use this for showing
qDebug() << QString::number( test, 'f', 2 );
But I want a value for calculation, not for showing.
Upvotes: 1
Views: 848