On Sunday, September 2, 2018 at 5:16:16 PM UTC+2, ohir wrote:
>
> On Sun, 2 Sep 2018 07:23:55 -0700 (PDT) 
> Manlio Perillo <manlio....@gmail.com <javascript:>> wrote: 
>
> > What happens if you need to divide 7 pennies by 4? 
>
> I do not know about pennies peculiarities, so I'll stay with ¤ ;) 
>
> I divide 70000µ¤ by 4 then It gives 17500µ¤. On customer account it 
> still is 17500µ¤ but on his statement it prints 0.018¤ (using 5/4 rounding 
> rules). The -500µ¤ goes to wherever local accounting law imposes on me. 
>
> Surely with pennies I'd do same thing ;) 
>
> > For financial applications you should use decimal floating-point 
> numbers. 
> And soon see pink slip. Or even go to jail. 
>
>
Then can I assume that all people using the Python decimal module are going 
to jail?

According to https://en.wikipedia.org/wiki/Floating-point_arithmetic, and 
to the decimal module documentation, Decimal is implemented using decimal 
floating point arithmetic.
https://github.com/python/cpython/blob/master/Lib/_pydecimal.py#L509


Manlio 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to