question: private static int magnitude ( double x ) { double xAbs = Math . abs ( x ) ; double xLog10 = Math . log ( xAbs ) / Math . log ( 10 ) ; int xMag = ( int ) Math . floor ( xLog10 ) ; double xApprox = Math . pow ( 10 , xMag ) ; if ( xApprox * 10 <= xAbs ) xMag += 1 ; return xMag ; }
target:  Determines the decimal magnitude of a number. The magnitude is the exponent of the greatest power of 10 which is less than or equal to the number.