This topic created in 5123 days ago, the information mentioned may be changed or developed.
如题,计算会得到多个结果,如何获取结果的小数点后的位数,将符合位数的结果输出。
3 replies • 1970-01-01 08:00:00 +08:00
 |
|
round?
|
 |
|
循环得到的结果,然后用正则匹配出符合你要求位数的那个结果。
ps:round是用来限定位数的吧?
round(1/3.0,2) --->0.33000000002 print round(1/3.0,2) --->0.33
|
 |
|
用round限定你需要的位数 然后和原数作比较。
|