美文网首页
Math.rint()和Math.round()的比较

Math.rint()和Math.round()的比较

作者: 27b0bd2612de | 来源:发表于2017-05-19 10:58 被阅读0次

    Math.rint()  : (实质:返回最接近参数的整数,如果有两个数同时接近,返回偶数的那一个

                               特殊情况:1)参数本身是整数,返回参数本身。2)如果不是数字,或者无穷大,正负0返回其本身)

    运行结果:

    Math.round()  :  (实质:四舍五入)

    运行结果:

    相关文章

      网友评论

          本文标题: Math.rint()和Math.round()的比较

          本文链接:https://www.haomeiwen.com/subject/ccditxtx.html