1.floor作用:一般用于处理精度问题
floor是向下取整,比如4.5取4
double right=4.5234;
printf("%.2lf\n",floor(right*100)/100); //答案是4.52
double right=4.53;
printf("%.2lf\n",floor(right)); //答案是4
double right=4.52;
printf("%.2lf\n",floor(right)/100); //答案是0.04
原文地址:https://www.cnblogs.com/Aiahtwo/p/9903230.html
时间: 2024-10-08 00:57:08