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

There is an easier String variant

int numb_d2(float n){
  String strn=str(n);
  return strn.length()-strn.indexOf(".")-1;
}

Additionally juanjoc specifficly asked for a non-String solution.

1 Like