code: function(x){
      return Math.pow(10, Math.floor(Math.log(x) / Math.LN10));
    }
docs: Returns the magnitude of the input value.
  @param {Integer, Float} x - integer or float value
  @return {Integer, Float} returns the magnitude of the input value