Protect against division by zero

If all values are the same they will be treated as "minimal value"
Merge pull request #3 from sorennielsen/master

Protect against division by zero