Created
February 29, 2016 21:42
-
-
Save ghing/758961f101c044523a46 to your computer and use it in GitHub Desktop.
Truncating floats and formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import decimal | |
'{:.1f}'.format(decimal.Decimal(99.955).quantize(decimal.Decimal('.1'), rounding=decimal.ROUND_DOWN)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment