四舍、六入、五凑偶之Math.Round()
来源:互联网 发布:违规网络音乐产品名单 编辑:程序博客网 时间:2024/06/02 10:28
Math.Round (Decimal, Int32)将小数值舍入到指定精度。
由 .NET Compact Framework 支持。Math.Round (Double, Int32)将双精度浮点值舍入到指定精度。
由 .NET Compact Framework 支持。
由 .NET Compact Framework 支持。Math.Round (Double, Int32)将双精度浮点值舍入到指定精度。
由 .NET Compact Framework 支持。
msdn并没有详细的说明清楚,给了一个例子;
Math.Round(3.44, 1); //Returns 3.4.Math.Round(3.45, 1); //Returns 3.4.Math.Round(3.46, 1); //Returns 3.5.
依照他的例子得到的是"五舍六入",我改变了一下数字得到的结果将完全改变。
Math.Round(3.445, 1); //Returns 3.4.
Math.Round(3.455, 1); //Returns 3.5.
Math.Round(3.465, 1); //Returns 3.5.
Math.Round(3.450, 1); //Returns 3.4.(补0是无效的)
Math.Round(3.4452, 2); //Returns 3.45.
Math.Round(3.4552, 2); //Returns 3.46.
Math.Round(3.4652, 2); //Returns 3.47.
世界上的许多国家已广泛采用“四舍六入法”。我国国家科委于1955年就作了推荐。“四舍 六入法”可以概括为:“四舍六入五考虑,五后非零就进一,五后皆零看奇偶,五前为偶应舍 去,五前为奇要进一。”Math.Round()方法使用的银行家算法的依据,是IEEE Standard 754这个国际标准。
- 四舍、六入、五凑偶之Math.Round()
- javascript的Math舍入函数
- Math.Round 之关于 不同的四舍五入
- Math.Round 之关于 不同的四舍五入
- Math.round()
- Math.Round
- Math.round
- Math.round()
- Math.Round
- Math.Round()
- Math.round()
- math。round and math。floor
- Math.ceil()和Math.floor()、Math.round()
- Math.round|Math.floor|Math.ceil区别
- Math.floor,Math.round,Math.ceil
- Math.round, Math.ceil 和 Math.floor
- Math.floor()/Math.ceil()/Math.round()
- Math.ceil、Math.floor、Math.round用法
- .java .class文件编译
- 宫崎峻《となりのトトロ》(龙猫)全剧本(中日对照)(1)
- Profile的作用
- 提前祝三八节快乐
- 宫崎峻《となりのトトロ》(龙猫)全剧本(中日对照)(2)
- 四舍、六入、五凑偶之Math.Round()
- IIS 配置数据库中AccessFlags属性的处理与应用
- 短路计算
- 兼容firefox的DIV居中
- 关于GridView分页
- 用户及权限管理
- 《敏捷软件开发》读书笔记
- SQL Server CHARINDEX和PATINDEX详解(转)
- oracle 存储过程