Unsolved QString::number() with a strange problem
-
Hi all
I found a little problem on [static]QString QString::number(double n, char format = 'g', int precision = 6)
e.g.QString::number(22.50, "f", 0); //it could not be "23"; QString::number(23.50, "f", 0); //it could be "24"; QString::number(22.53, "f", 0); //it could be "23";
Is that right, or could you please tell me how to round the number in this code?
Best regards
Mihan -
@Mihan said in QString::number() with a strange problem:
number
If you want to round numbers properly you should use https://doc.qt.io/archives/qt-4.8/qtglobal.html#qRound instead of QString.