How to count the number of digits of a floating number?

int numb_d(double n){
int nb=0;
while(((double)pow(10,nb))*n!=(int) (((double)pow(10,nb))*n)&&nb<=11) nb++;
return nb;
}

this code will work up to 10 total digits. Then this code too will start having problems with calculating results.
Then up to a total of 16 digits the String conversion methods will still work and then the capacity of double is full.

1 Like