9

0.1+0.2 !== 0.3?

 5 years ago
source link: https://juejin.im/post/5bd2f10a51882555e072d0c4
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
前言 众所周知,JavaScript在计算某些浮点数的运算时会出现精度的丢失,比如你在控制台输入0.1+0.2,得到的结果是0.30000000000000004而不是0.3,原因是什么? 世界上有两种人,懂二进制和不懂二进制的人 我们知道,计算机里所有的数据

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK