The magic wand auto-fitting button in the texture viewer automatically calculates the min and max values of any visible channel in the texture, and rescales the visible range to include them.
If you right click on it, it will toggle on a mode to automatically rescale every time the viewed texture changes.