fixing invalid metric values

This is to fix a problem where very large or very small float values were getting into Infinity/NaN states.

Sidekick: @lars2893 
FYI: @tmacie