Hi, I have just scared. I expect that is here with some mathematical and physical constants, and get for a particular value for my double variable "ExpTerm = 2.22184e-09" out. The next step, I reckon (x is also a double) Code: x = 1 - expTerm; court <<"1 - expTerm = "<<x <<endl; However, the result gives me a "1 - 1 from expTerm ="! In such an accuracy could, of course I completely forgot my account immediately. How can I increase the accuracy?
Hmm, this works for me no better: Code: # Include <iostream.h> # Include <stdlib.h> int main () ( double expTerm = 2.22184e-09; court <<"expTerm = "<<expTerm <<endl; expTerm expTerm = 1.0; court <<"1.0 - expTerm = "<<expTerm <<endl; system ("PAUSE"); return 0; ) is with me again "1.0-expTerm = 1" Is this due to my compiler, or at least to the number of Kleinhiet (exp ^ (-9))?
Actually, it should not be an issue, because according to the literature has a double 64 bit and can therefore theoretically represent a range of + -1.7 * 10 ^ (-308). In <float.h> is also established that there are 52 double digits . This should actually be sufficient to calculate the difference specified correctly and also issue to ...
in the numeric_limits <T> there is in the double epsilon ^ -16 which is the value at which one-value = 1: O)