Log10

Public Function Log10(ByVal Number As Double) As Double

Returns the base 10 logarithm

SendDebug Log10(100) 'Prints 2, because 100 = 10^2
SendDebug Log10(10) 'Prints 1, because 100 = 10^1
SendDebug Log10(0) 'Prints -Infinity
SendDebug Log10(Pi) 'Prints 0.49714987269413385

Public Function DigitCount(pNumber As LongLong) As Long
   'Returns the number of digits needed to print the specified pNumber
   
   If pNumber = 0 Then
       Return 1 ' '0' is printed using 1 digit.
   ElseIf pNumber < 0 Then
       Return DigitCount(-pNumber) + 1 '+1 to get space for the minus.
   Else
       Return Int(Log10(pNumber)) + 1
   End If
End Function

See also: