2013年11月25日

Math.Round四舍五入说明

摘要: Math.Round默认采用的不是四舍五入法, 而是四舍六入的银行家算法, 如何找回四舍五入法?Math.Round默认采用的不是四舍五入法, 而是四舍六入的银行家算法, 也就是四舍六入五考虑,五后非零就进一,五后皆零看奇偶,五前为偶应舍 去,五前为奇要进一, 这个算法比四舍五入更精确些. Response.Write("" + Math.Round(144.34, 1)); --144.3 Response.Write("" + Math.Round(144.15, 1));--144.2 Response.Write("" + M 阅读全文

posted @ 2013-11-25 14:30 neights 阅读(438) 评论(0) 推荐(0) 编辑

导航