| commit | d99d853ef990df7d5589dc4c8ce69d9745f33367 | [log] [tgz] |
|---|---|---|
| author | Rob Taylor <rob@shape.build> | Sun Dec 20 23:19:31 2020 +0000 |
| committer | Rob Taylor <robtaylor@floopily.org> | Tue Dec 22 17:54:33 2020 +0000 |
| tree | a751e8b89fd1ae5f57d6872ff3a598dfbd09c058 | |
| parent | 3d7617a1acb92ea883539bcf22a632d6361a5de4 [diff] |
Faster version of liberty_float - gives a 25% to 50% speedup
This also fixes a bug in liberty_float for numbers with a magnitute
between 9 and 15.
Previously:
>>> liberty_float(1e15)
'1000000000000000'
>>> liberty_float(1e10)
'10000000000.'
>>> liberty_float(1e9)
'1000000000.0'
>>> liberty_float(1e16)
'1.000000e+16'
Now:
>>> liberty_float(1e15)
'1.000000e+15'
>>> liberty_float(1e10)
'1.000000e+10'
>>> liberty_float(1e9)
'1000000000.0'
>>> liberty_float(1e16)
'1.000000e+16'