Hello people,
Let's say i have a QString named szNum containing "4532.361670".
i want to put it in a float, so i'm doing
float fNum = szNum.toFloat();
float fNum = szNum.toFloat();
To copy to clipboard, switch view to plain text mode
Then when i do a
qDebug () << fNum
qDebug () << fNum
To copy to clipboard, switch view to plain text mode
the output is "4532.36".
So, from here i have two guesses:
- My number is fine, but qDebug doesn't display it with the precision after 2.
- My number didnt get converted from QString to float with a good precision.
So the question is: is there a QT function to convert such a string to a float with a better precision? Or do i have to split my string on the dot ".", then store the int part in my float, then add to my float the decimal part divided by 1^(Numbers_Of_Digits+1)?
Thanks ^^
Pierre.
Bookmarks