当前位置:网站首页>Why is 0.1 + 0.2 not equal to 0.3? How to solve this problem?
Why is 0.1 + 0.2 not equal to 0.3? How to solve this problem?
2022-07-28 22:05:00 【Big chicken legs are best】
The internal calculation of the computer is to convert it into binary numbers, add them, and then convert them into 10 Hexadecimal number ,js Use double precision floating-point numbers to store ( Use 64 position Fixed length to save )
0.1 and 0.2 Turn into 2 Hexadecimal followed by wireless loop 1100( Both numbers are infinite circular decimal ), So the sum of the two naturally does not equal 0.3 Turn into 2 The value of base
resolvent
1, Convert to integer first , Add it up and turn it back to decimal
2, Use number Object's toFixed Method ,toFixed Method can specify the number of specified digits after the decimal point of the operation result , To keep one decimal place is toFixed(1)
边栏推荐
- kingbase中指定用户默认查找schema,或曰用户无法使用public schema下函数问题
- Aimbetter insight into your database, DPM and APM solutions
- 字节一面:TCP 和 UDP 可以使用同一个端口吗?
- Pyqt5 rapid development and actual combat 5.4 web page interaction
- RHCSA第一天
- Using Baidu easydl to realize chef hat recognition of bright kitchen and stove
- OA项目之会议通知(查询&是否参会&反馈详情)
- msfvenom制作主控与被控端
- 开放式耳机哪个音质好、公认音质好的气传导耳机推荐
- 熊市下 DeFi 的未来趋势
猜你喜欢

基于多模态融合的非遗图片分类研究

Lt7911d type-c/dp to Mipi scheme is mature and can provide technical support

基于对象的实时空间音频渲染丨Dev for Dev 专栏

搞事摸鱼一天有一天
![[geek challenge 2019] secret file & file contains common pseudo protocols and gestures](/img/aa/a169cdd8cc6cdfda6d2777511b4dd2.png)
[geek challenge 2019] secret file & file contains common pseudo protocols and gestures

迪赛智慧数——折线图(堆叠面积图):2022年不同职业人群存款额占月收入比例排名

OA项目之会议通知(查询&是否参会&反馈详情)

HYDAC溢流阀DB08A-01-C-N-500V

Technology selection rust post analysis

How to skillfully use assertion + exception handling classes to make the code more concise! (glory Collection Edition)
随机推荐
90. Subset II
数据可视化新闻,不一样的新闻报道形式
纳米金偶联抗体/蛋白试剂盒(20nm,1mg/100μg/500 μg偶联量)的制备
迪赛智慧数——折线图(堆叠面积图):2022年不同职业人群存款额占月收入比例排名
Wechat applet development company, do you know how to choose?
04.toRef 默认值
[cloud native kubernetes] mapping external service under kubernetes cluster eendpoint
What technology is needed for applet development
详解visual studio 2015在局域网中远程调试程序
笔试总结记录
系统分析师
Skiasharp's WPF self drawn drag ball (case version)
什么是质因数,质因数(素因数或质因子)在数论里是指能整除给定正整数的质数
[brother hero July training] day 28: dynamic planning
Bugku,Web:都过滤了
PCB材料简单介绍
How to design workflow engine gracefully (glory Collection Edition)
使用Mock技术帮助提升测试效率的小tips,你知道几个?
Divide and conquer, upload large files in pieces
Edited by vimtutor