March 5th, 2013, 04:10 PM
Originally Posted by arkhamshock
My issue is that I've been inormed that my code requires greater than double precision to present accurate results as we're dealing with extremely small numbers(10^-25) and i would require lots of decimal places.
You have been informed incorrectly - or possibly you mis interpreted ot misrepresented the advice. The smallest representable value of double is (typically, depending on representation): 2.2250738585072014e-308; many orders of magnitude smaller than you need.
is not the same as magnitude
, and it is not about how many zeros follow the decimal point (that would be true of fixed point
but not floating point
representations) . The double type is good for 15 significant figures
regardless of magnitude. Note that unless you specifiy the required output precision, standard output functions such as printf() will display fewer significant figures.
In the event that you do indeed need greater precision for reasons that you have not clearly expressed here, then your compiler may support long double
, which is good for 20 significant figures on x86 architectures. Beyond that you will
need arbitrary precision library support, but your argument for doing so is not clear, and on the face of it you don't need one.