[Python-ideas] Round division
Guido van Rossum
guido at python.org
Fri Sep 11 18:30:35 CEST 2015
On Fri, Sep 11, 2015 at 9:18 AM, Emile van Sebille <emile at fenx.com> wrote:
> On 9/10/2015 11:27 PM, Serhiy Storchaka wrote:
>
>> On 11.09.15 06:13, Steven D'Aprano wrote:
>>
>>> How does this differ from round(a/b)? round() also rounds to even.
>>>
>>
>> >>> round(5000000000000000/9999999999999999)
>> 0
>> >>> round(14999999999999999/10000000000000000)
>> 2
>>
>> But fractions 5000000000000000/9999999999999999 > 1/2 and
>> 14999999999999999/10000000000000000 < 3/2.
>>
>>
> Wow -- I'm glad I work predominately in business environments and keep
> amounts in pennies. The only time I need to round anything is to the
> nearest cent.
>
I thought any programmer worth their salt would round down (i.e. trunc())
and transfer the fractional penny to their own account? :-)
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150911/496c2f61/attachment-0001.html>
More information about the Python-ideas
mailing list