Fix over-precise float formatting on Python 3 #1241
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sometimes tox would tell me things like
the almost-rounded-to-3-decimals value was both funny and sad, but mostly irritating.
This was happening because on Python 3 float.__str__ was changed to be more precise, and now
We can avoid the problem if we round the result of the addition instead of adding a rounded number to the integer number of seconds:
I've also corrected the plural logic because "0.5 second" is wrong:
https://ell.stackexchange.com/questions/7817/singular-or-plural-for-seconds
Contribution checklist:
(also see CONTRIBUTING.rst for details)
updated/extended the documentation-- not applicable, I thinkadded relevant issue keyword-- I've filed no issue and found no existing issue for thisin message body
<issue number>.<type>.rst
for example (588.bugfix.rst)<type>
is must be one ofbugfix
,feature
,deprecation
,breaking
,doc
,misc
superuser
."CONTRIBUTORS
(preserving alphabetical order)