I have one specific problem when converting values doubleto a string using sprintf()on UNIX.
For example, I have two values:
double a = 0.009984354523452;
double b = 0.01;
During the conversion, I use:
sprintf(somestringvar, "Double value : %.15f \n", a);
sprintf(diffstringvar, "Double value : %.15f \n", b);
to convert to string.
My problem is for 'a', the value prints correctly, but for the value of 'b', 0 is added at the end. Please provide me with a general way of representing "a" and "b" as exact values.
source
share