HI all,
I have a strange application where I need the precision of long doubles. However, when testing division, I ran into a snag:
And from GDB I get:
tmp = 0.1666666666666666666711841757186896
which, admittedly is better than just a plain double, but I was expecting something like:
0.1666666666666666666666666666666667
So, then I tried:
Which GDB tells me is:
tmp = 0.1666666666666666574148081281236955
Strange? Any ideas? I'm compiling in debug mode with GCC4.0 with no optimization.
Also, I'm very new to Xcode/mac, and I'm a little rusty in c++.
Any help much appreciated.
I have a strange application where I need the precision of long doubles. However, when testing division, I ran into a snag:
Code:
long double tmp;
tmp = 1.0L / 6.0L;
tmp = 0.1666666666666666666711841757186896
which, admittedly is better than just a plain double, but I was expecting something like:
0.1666666666666666666666666666666667
So, then I tried:
Code:
tmp =0.1666666666666666666666666666666667;
tmp = 0.1666666666666666574148081281236955
Strange? Any ideas? I'm compiling in debug mode with GCC4.0 with no optimization.
Also, I'm very new to Xcode/mac, and I'm a little rusty in c++.
Any help much appreciated.