Understanding how many digits within a number
Hi
I am trying to work out how large a number is determined by how many indivdual numbers are in a numbers.
For example, I know that 100 has three digits. And 10 has two digits. I am having difficulty understanding how to receive this information to bang further information
J
try [expr int(log10($i1))+1]
basically log10 converted to integer, and then + 1.
...there are probably cheaper ways of doing it, but hey.
thank you
[itoa] and then some list manipulation is probably a tad cheaper, CPU-wise, but the log() formula works.
Back in the days when I was using a BASIC interpreter on a Commodore C64, it actually made a difference, but that was a long time ago.