A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-September/155363.html below:

[Python-Dev] Change in Python 3's "round" behavior

[Python-Dev] Change in Python 3's "round" behavior [Python-Dev] Change in Python 3's "round" behaviorGreg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 30 17:50:36 EDT 2018
Alex Walters wrote:
> Other use case is finance, where you can end up with interest calculations
> that are fractional of the base unit of currency.  US$2.345 is impossible to
> represent in real currency, so it has to be rounded.

This brings us back to my original point about floating point
accuracy. If you do your interest calculation in floating
point binary, first it's very unlikely that it will come
out ending in exactly 0.5 of a cent, and secondly if you
care about the details that much, you should be calculating
in decimal, and being explicit about exactly what kind of
rounding you're doing.

-- 
Greg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4