c++ - How to store double with maximum precision -
i'm bit stucked storing number maximum available precision:
double tmp = 569.232306826889043804840184748172760009765625l; i'm trying print on screen:
printf("%0.52f\n", tmp); and that's i've got:
569.2323068268890400000000000000000000000000000000000000
is maximum precision can achieve?
p.s. i'm using visual studio 2008
a double stored in ieee 754 binary64 format.
a binary64 has 52 bits of precision, not 52 decimal digits - equivalent @ 17 decimal digits, you're displaying.
is maximum precision can achieve?
some platforms may provide long double bigger double, yours doesn't seem to.
if want more precision, can either use library exposes larger/more precise type supported hardware (such 80-bit extended double), or arbitrary-precision library works in software.
Comments
Post a Comment