C's pow() function as per header file <math.h> not working properly

前端 未结 2 1632
陌清茗
陌清茗 2020-12-22 11:28

I see that for the following code produces the result as below, any idea on why is the output like this?

#include 
#include 

in         


        
2条回答
  •  星月不相逢
    2020-12-22 12:23

    Use the round() function before casting to int, else the trailing digits will just get truncated.

提交回复
热议问题