Refactored Number logarithm code.