I am trying to get the length of a float, but it is saying the length is 8. I want to know how many digits there are. why is it saying that there are only 8 digits?
#include <stdio.h>
int main()
{
double n = 72382.413651;
int len;
len = sizeof(n);
printf("%d\n", len);
}
I am needing to know the length of the float because it will be beneficial in making a table table of logarithms like this.
--------------------------
| 1000000 | 72382.413651 |
--------------------------
Springboarding off of dasblinkenlight and Eric - An example of what you can do is simply edit your code to look like this:
This will print the value to look exactly as it does in the declaration.
Or, say you have to deal with numbers with decimal points in various positions but want the formatting to be in neat columns. You could do something like this: