Higher precision for the result log(x)
-
Hi!
I am using
double c, y, z; double x = c*(log(y)-log(z));
Well the result is correct, as long as "c" is small. If it gets bigger, the result of x diverges pretty much from the same result calculated in R or in Mathematica.
I suppose, a higher precision of more decimal places - especially if y and/or z is small - might lead to better results.
I tried to solve it with QString and precision, but this did not work so far.
Is there a better solution for increasing the precision of decimal places?
Please let me know!
-
This is not really a Qt question.
C++ double type has a precision defined by the IEEEE 754 standard and it is not configurable.
If you need higher precission than it offers you need to use another (custom) type.
There are 3rd party libraries providing such types, for example GMP, ttmath or the Boost Multiprecision Library. -
Topic moved to C++ Gurus