how can I compute the number of digits A= how can I get 5 as the number of digits in A?
No products are associated with this question.
To count integer part
floor(log10(abs(A)+1)) + 1
Long, but it gets the job done.
Will do the trick for all nonzero integers:
For a 10,000 iteration benchmark with some above answers:
Jaymin= 1.423717 seconds; Stephanie= 0.476135 seconds; Mine= 0.000878 seconds
If you don't expect 0s to appear, this is the fastest and most accurate method. Only works for decimals that satisfy -1<A<1.