0.9999999999999999999999 == 1?
来源:互联网 发布:js如何定义集合 编辑:程序博客网 时间:2024/04/25 11:41
如题
#include<stdio.h>int main(){ if(0.99999999999999999 == 1) // 17位 printf("Yes\n"); else printf("No\n"); if(0.9999999999999999 == 1) // 小数位 共16位 printf("Yes\n"); else printf("No\n");}
结果:
Yes
No
原因
- 浮点数默认时double型。
- double 小数位16位
- 浮点数超出精度,会自动四舍五入。
其他
浮点数不能 用 == 比较0
从如何判断浮点数是否等于0说起——浮点数的机器级表示
阅读全文
0 0
- 0.9999999999999999999999 == 1?
- ===管理妙计1===
- ~0 == -1
- ======Java中的SSL通信初步(1)======
- //============代码片段2-1:外部命令中Excute函数的定义============
- 1=
- 1 . JS中的!=、== 、!==、===的用法和区别。
- 1、ES6 === let && const
- Why does ++[[]][+[]] == 1?
- index of("") ==-1
- ActionScript中false==0, true==1
- ‘1’==1和‘1’===1的区别
- static const char sep[256] = { [' ']=1, ['.']=1, ['-']=1, ['_']=1 }
- JavaScript中,1=='1'?1==='1'?
- 1+1=?
- 1+1=?
- where 1=1
- 1+1=
- HDU
- 并查集(Union Find)简介
- 《Unity3D》用PlayerPres来保存读取自定义类型数组
- docker中容器的四种网络模式详解
- 大型定时任务数据结构HashedWheelTimer
- 0.9999999999999999999999 == 1?
- GoldenGate Integrated Capture Mode介绍及配置方法
- redis 4 搭建集群
- Spring IOC依赖注入的过程分析
- 《Neural Networks for Machine Learning》学习笔记
- 《STL源码剖析》-序列式容器(一)vector容器
- Glide缓存源码解析
- 2017百度之星初赛
- MySQL explain执行计划