include<stdio.h>
int main()
{
double x=-1.99999999999999980000; while(x>-2.0&&x-1==-3.0) puts("orz"); return 0;
}
can anybody give some explaination ,thank you..
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 170 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 160 |
5 | djm03178 | 158 |
5 | -is-this-fft- | 158 |
7 | adamant | 154 |
7 | Dominater069 | 154 |
9 | awoo | 153 |
10 | luogu_official | 152 |
int main()
{
double x=-1.99999999999999980000; while(x>-2.0&&x-1==-3.0) puts("orz"); return 0;
}
can anybody give some explaination ,thank you..
Name |
---|
deleted
I think you misunderstood me: what I mean is for x=-1.99999999999999980000 I want to know the truth of this statement:x>-2.0&&x-1==-3.0 if x==-1.99999999999999980000 how can x-1==-3.0,it should be -2.99999999999999980000 if it has accuracy error and rounding off to -3.00, but why x=-1.99999999999999980000 not rounding to -2.0 but x>-2.0.
My own machine regard this statement false,but CF compilors regard it as true,I don't why...
aha , sorry for my misunderstanding , i don't know why this happens but i think misof articles about integer and real representation can help you .
you can find it here .
https://gcc.gnu.org/bugs/#nonbugs_general