会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Hider1214
博客园
首页
新随笔
联系
订阅
管理
2022年1月14日
Python学习笔记:精确的四舍五入
摘要: 一、背景 日常工作中,如果对数据精度不敏感,则可以使用 ceil、floor、round 等函数对数据做取整、四舍五入操作即可。 # 取整 import math x = 11.245 math.ceil(x) # 向上 12 math.floor(x) # 向下 11 round(x) # 四舍五
阅读全文
posted @ 2022-01-14 09:56 Hider1214
阅读(1393)
评论(0)
推荐(0)
公告