问题
When I want to know how many digits of a big number, I'd do this:
user> (count (str (factorial-bigint-loop 32)))
36
Is there a better way? Can I represent the number in scientific notation?
回答1:
If the number is strictly positive, something like: (+ 1 (floor (log10 n)))
should do the trick
来源:https://stackoverflow.com/questions/27229987/can-i-know-how-many-digits-a-number-is-without-count-it