Fix scientific notation and refactor number formatting

Haven't tested, but this should be much cleaner - makes for much nicer
scientific notation, too.

Fixes #26