码迷,mamicode.com
首页 > Web开发 > 详细

解决js 0.1 + 0.2 = 0.30000000000000004 的位数精度问题

时间:2019-11-01 18:06:40      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:https   精度   archive   tofixed   fixed   class   html   http   arc   

https://www.html.cn/archives/7340

 

解决办法

parseFloat((0.1 + 0.2).toFixed(10)) 

 

解决js 0.1 + 0.2 = 0.30000000000000004 的位数精度问题

标签:https   精度   archive   tofixed   fixed   class   html   http   arc   

原文地址:https://www.cnblogs.com/ww01/p/11778317.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!