magnitude function

magnitude returns the magnitude of numbers in base 10