0 isn't a number?
Let's say we have 0.382:
Code:
x = log10(fabs(0.382)); // x = -0.417937
return x >= 0 ? x + 1 : 1; // 1
There is 1 integral algarism there: 0.
If you need to consider zero (the integral part) as "no algarism", change the final 1 to zero:
Code:
return x >= 0 ? x + 1 : 0;