当前位置:网站首页>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)}");
边栏推荐
- Pyscript,创建一个能执行crud操作的网页应用
- 365 days challenge LeetCode1000 questions - Day 052 Step by step summation to get the minimum value of positive numbers Greedy
- C language structure, function and pointer exercise (simple address book)
- XSS详解及复现gallerycms字符长度限制短域名绕过
- Solidity最强对手:MOVE语言及新公链崛起
- 【毕业设计】基于ESP32的在线墨水屏桌面摆件 -物联网 单片机 嵌入式
- 移动终端数据业务高安全通信方案研究
- 【报错】ModuleNotFoundError: No module named ‘scp‘
- Mysql database ALTER basic operations
- 数据的存储——C语言
猜你喜欢
随机推荐
GB28181 sip和RTSP(Real-Time Streaming Protocol)实时流控制协议
Biotin-Cy2 Conjugate,生物素-Cy2 偶联物_Cy2 生物素偶联物
22.括号生成
开发IM即时通讯容易吗?需要什么技术
How to add control panel to right click menu in win7
使用 apxs 构建和安装 Apache 扩展共享对象模块
头脑风暴:单词拆分
移动终端数据业务高安全通信方案研究
宝塔实测-搭建LightPicture开源图床系统
eyb:Redis学习(4)
DHCP——动态主机配置协议
ABAP 里文件操作涉及到中文字符集的问题和解决方案
西安生物素-四聚乙二醇-酰胺-4苯酚 浅黄色半固态
你有对象类,我有结构体,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang结构体(struct)的使用EP06
Stanford CS143 Speed Pass PA1 Tutorial
快速响应性智能型/智能响应性聚乙二醇纳米/还原响应型水凝胶的研究与制备
你有对象类,我有结构体,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang结构体(struct)的使用EP06
芯片资讯|半导体收入增长预计将放缓至 7%,蓝牙芯片需求依然稳步增长
基于SSM实现手机销售商城系统
pyhton之问~~~~~if __name__ == ‘__main__‘:是什么?