c++ - Typecasting processed float value to int reduces the actual value -
this question has answer here:
in c++, floor(9099.96 *100.0) giving me answer 909995. expecting 909996.
i not able think of explanations here. appreciated.thanks.
this proper result: according ieee754 calculator, value of 9099.96 represented 9099.9599609375 in double. after multiplication 100 909995.99609375. taking floor gives 909995.
Comments
Post a Comment