博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C#中小数点后保留两位小数,四舍五入的函数及使用方法(转)
阅读量:4687 次
发布时间:2019-06-09

本文共 326 字,大约阅读时间需要 1 分钟。

 

Math.Round(45.367,2)     //Returns   45.37
Math.Round(45.365,2)     //Returns   45.36
 C#中的Round()不是我们中国人理解的四舍五入,是老外的四舍五入,是符合IEEE标准的四舍五入,具体是四舍六入,下面的才是符合中国人理解的四舍五入
Math.Round(45.367,2,MidpointRounding.AwayFromZero);//45.37
Math.Round(45.365,2,MidpointRounding.AwayFromZero)     //Returns   45.37  

转载于:https://www.cnblogs.com/yubufan/p/4234667.html

你可能感兴趣的文章
Linux学习之CentOS(二十五)--Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理
查看>>
【bzoj4310/hdu5030-跳蚤】后缀数组
查看>>
深度信任网络的快速学习算法(Hinton的论文)
查看>>
RSA System.Security.Cryptography.CryptographicException
查看>>
s的封装和信息隐蔽
查看>>
excelhttp://www.cnblogs.com/caoyuanzhanlang/p/3591904.html
查看>>
ArrayList和LinkedList和Vector源码分析
查看>>
webservice整合spring cxf
查看>>
再次编译这个应用程序应该不会有问题
查看>>
Ubuntu-tomcat7目录
查看>>
189. Rotate Array
查看>>
asp.net 的三种开发模式
查看>>
Android 交叉编译 IPerf3
查看>>
Android原生Gallery关于图像Orientation的问题
查看>>
[解题报告] 100 - The 3n + 1 problem
查看>>
Entity Framework 学习高级篇1—改善EF代码的方法(上)
查看>>
Mybatis逆向工程配置文件详细介绍(转)
查看>>
数组 Arrays类
查看>>
String类的深入学习与理解
查看>>
OLTP vs OLAP
查看>>