Fix scientific notation and refactor number formatting

Haven't tested, but this should be much cleaner - makes for much nicer
scientific notation, too.
Merge pull request #46 from MarkTraceur/issue-26

Fix scientific notation and refactor number formatting