[Interest] how to convert double to int safely?

nus1998 nus1998 at yeah.net
Tue Nov 25 09:33:51 CET 2014


Hi All, I have some code like followed:

    doubled=9.02;
d/=0.02;
inti=static_cast<int>(d);
qDebug()<<d<<i;

the result is 451 and 450, but I want  'i' be 451 too, how?  
thanks in advance


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141125/5a0e0f6e/attachment.html>


More information about the Interest mailing list