logBase 10 erroneous

Float arithmetic is subject to this kind of issues. If I had to count the number of digits of a number, I’d use recursive integer division by 10 such as https://www.geeksforgeeks.org/program-count-digits-integer-3-different-methods/

1 Like