由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - compare double to float
相关主题
请教一道入门小题请教一个作用域的问题
题2[合集] C++问题(copy constructor)
a simple question for C++ class问一个简单的C++问题
请问一个exception题目一个指向指针的指针的引用?
两个继承问题问个char*的问题
为什么我看不懂下面的code,是不是水平还不够?数组弱问
C++疑问[合集] 关于构造函数
two c++ interview questions! (转载)C++菜问: 怎么这样也可以?
相关话题的讨论汇总
话题: float话题: double话题: compare话题: true
进入Programming版参与讨论
1 (共1页)
g*****e
发帖数: 14
1
why this prints true?
#include
using namespace std;
int main() {
double a = 1.9;
float b = 1.9;
cout << (a > b ? "true" : "false") << endl;
}
X****r
发帖数: 3557
2
Because 1.9 cannot be precisely represented in either float or double,
and the values of cooresponding representations differ.

【在 g*****e 的大作中提到】
: why this prints true?
: #include
: using namespace std;
: int main() {
: double a = 1.9;
: float b = 1.9;
: cout << (a > b ? "true" : "false") << endl;
: }

t****t
发帖数: 6806
3
你为啥弄个女的头像,你太WS了

【在 X****r 的大作中提到】
: Because 1.9 cannot be precisely represented in either float or double,
: and the values of cooresponding representations differ.

X****r
发帖数: 3557
4
ft, 我在telnet下呢,怎么设头像?

【在 t****t 的大作中提到】
: 你为啥弄个女的头像,你太WS了
X****r
发帖数: 3557
5
现在试试……

【在 X****r 的大作中提到】
: ft, 我在telnet下呢,怎么设头像?
s*****r
发帖数: 773
6
so how is it represented?
Thanks!

【在 X****r 的大作中提到】
: Because 1.9 cannot be precisely represented in either float or double,
: and the values of cooresponding representations differ.

j****g
发帖数: 597
7
depends on your platform.
IEEE has standard for fload number representation. But different platforms
may have their own formats.
p**s
发帖数: 2707
8
你为啥不穿裤子,你太WS了

【在 t****t 的大作中提到】
: 你为啥弄个女的头像,你太WS了
j****g
发帖数: 597
9
人家那叫酷,宁可不穿裤子也要玩滑板。
t****t
发帖数: 6806
10
我靠,我明明穿了裤子的啊
难道这破系统知道你是毛人,把裤子给脱了?

【在 p**s 的大作中提到】
: 你为啥不穿裤子,你太WS了
s*****r
发帖数: 773
11
Thanks!

【在 j****g 的大作中提到】
: depends on your platform.
: IEEE has standard for fload number representation. But different platforms
: may have their own formats.

1 (共1页)
进入Programming版参与讨论
相关主题
C++菜问: 怎么这样也可以?两个继承问题
c++之极弱问为什么我看不懂下面的code,是不是水平还不够?
请教一个c++ reference问题C++疑问
大家来做题C++。two c++ interview questions! (转载)
请教一道入门小题请教一个作用域的问题
题2[合集] C++问题(copy constructor)
a simple question for C++ class问一个简单的C++问题
请问一个exception题目一个指向指针的指针的引用?
相关话题的讨论汇总
话题: float话题: double话题: compare话题: true