当前位置:财税问题 >
實(shí)務(wù)
问题已解决
怎么讓計(jì)算數(shù)值 保留小數(shù)點(diǎn)后2位
![](https://member.chinaacc.com/homes/resources/images/home/avatar/7.jpg)
![](/wenda/_nuxt/img/iconWarn.60bd4fe.jpg)
![](https://pic1.acc5.cn/008/02/86/21_avatar_middle.jpg?t=1679474745)
你可以使用 round() 函數(shù),在參數(shù)中指定小數(shù)位數(shù)。例如:round(3.1415926535,2),它的結(jié)果就是3.14。
2023 03/22 18:44
![](http://member.chinaacc.com/homes/resources/images/home/avatar/7.jpg)
84785037 ![](/wenda/_nuxt/img/reply1.d92ea43.png)
![](/wenda/_nuxt/img/reply1.d92ea43.png)
2023 03/22 18:44
那如果想要四舍五入呢?
![](https://pic1.acc5.cn/008/02/86/21_avatar_middle.jpg?t=1679474745)
青檸 ![](/wenda/_nuxt/img/reply2.28c7604.png)
![](/wenda/_nuxt/img/reply2.28c7604.png)
2023 03/22 18:44
可以使用 round() 函數(shù)的第三個(gè)參數(shù),指定四舍五入的方式,默認(rèn)是round to nearest even number,即最接近的偶數(shù),但也可以指定為 round up 或者 round down,例如round(3.1415926535,2, up)即可實(shí)現(xiàn)四舍五入。
![](/wenda/img/newWd/sysp_btn_eye.png)