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 | |
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.
|