当前位置:网站首页>C# 四舍五入 MidpointRounding.AwayFromZero
C# 四舍五入 MidpointRounding.AwayFromZero
2022-08-10 00:41:00 【王源骏】
四舍五入 在计算中 经常使用到,但是如果使用 Math.Round,只是五舍六入
在Math.Round内传入MidpointRounding.AwayFromZero枚举,就可以实现四舍五入的效果了,
Debug.Log($"四舍五入{
66.6}。。。{
(int)Math.Round(66.6, MidpointRounding.AwayFromZero)}");
Debug.Log($"四舍五入{
66.5}。。。{
(int)Math.Round(66.5, MidpointRounding.AwayFromZero)}");
Debug.Log($"四舍五入{
66.4}。。。{
(int)Math.Round(66.4, MidpointRounding.AwayFromZero)}");
Debug.Log($"四舍五入{
66.6}。。。{
(int)Math.Round(66.6)}");
Debug.Log($"四舍五入{
66.5}。。。{
(int)Math.Round(66.5)}");
Debug.Log($"四舍五入{
66.4}。。。{
(int)Math.Round(66.4)}");
边栏推荐
- 输入的这些数是否对称
- 365天挑战LeetCode1000题——Day 052 逐步求和得到正数的最小值 贪心
- 微信公众号如何开通支付功能?
- Quick responsiveness intelligent/smart responsiveness of polyethylene glycol type nano/reduction response hydrogels research and preparation
- 微信小程序tab切换时保存checkbox状态
- oracle的数据导入导出
- Pyscript,创建一个能执行crud操作的网页应用
- Docker interview question 2--get the number of database connections and docker-compose
- el-input保留一位小数点
- 【毕业设计】 基于Stm32的家庭智能监控系统 - 单片机 图像识别 人体检测 AI
猜你喜欢
随机推荐
Solidity 智能合约入门
微信小程序tab切换时保存checkbox状态
20220809-PotPlayer如何设置默认字体色-设置默认字体色的方法
高校就业管理系统设计与实现
改变社交与工作状态的即时通讯是什么呢?
What do you know about FITC-labeled biotin (FITC-biotin|CAS: 134759-22-1)?
3438. 数制转换
PEG 衍生物Biotin-PEG1-OH(cas:95611-10-2,2-生物素氨基乙醇)优势说明
走出迷宫的最少步数2
PEG derivative Biotin-PEG1-OH (cas: 95611-10-2, 2-biotinaminoethanol) advantage description
3511. 倒水问题
Win7怎么把控制面板添加到右键菜单
头脑风暴:单词拆分
Summary of basic operations of c language files
快速响应性智能型/智能响应性聚乙二醇纳米/还原响应型水凝胶的研究与制备
@PostConsturct注解作用及特点
什么是持续测试?
信息化和数字化的核心差异
【CAS:41994-02-9 |Biotinyl tyramide】生物素基酪氨酰胺价格
Fedora 36 dnf 安装ModSecurity和 OWASP 核心规则集










