Borrowed from http://mxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/histogram_tools.py
better histogram bucketing