当前位置:网站首页>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)}");
边栏推荐
猜你喜欢
随机推荐
Xi'an biotin-tetrapolyethylene glycol-amide-4phenol light yellow semi-solid
微信小程序tab切换时保存checkbox状态
【kali-密码攻击】(5.1.2)密码在线破解:Medusa
数据的存储——C语言
递归 二分查找 冒泡排序 快速排序
Enhanced Deep Residual Networks for Single Image Super-Resolution
Involved in PEG-Biotin (CAS: 1778736-18-7) Biotin-PEG4-OH is widely used in molecular target detection
Biotin-Cy2 Conjugate, Biotin-Cy2 Conjugate_Cy2 Biotin Conjugate
c语言指针练习题
C语言--数据的存储(上)
R语言使用coxph函数构建生存分析回归模型,使用forestmodel包的forest_model函数可视化生存回归模型对应的森林图
el-input保留一位小数点
【Grpc】报错:status = StatusCode.UNIMPLEMENTED details = ““
宝塔实测-搭建LightPicture开源图床系统
ASEMI整流桥GBJ1010参数,GBJ1010规格,GBJ1010封装
flask——请求、响应、请求扩展、session、闪现、蓝图、g对象、flask-session
XSS详解及复现gallerycms字符长度限制短域名绕过
Stanford CS143 Speed Pass PA1 Tutorial
Sikuli 基于图形识别的自动化测试技术
20220809-PotPlayer如何设置默认字体色-设置默认字体色的方法