

Development of billing system with Django framework - borisdus
http://blog.bitcalm.com/Development-billing-system-Django-framework/

======
cryowaffle
Money should be represented in the base unit, for dollars that is cents. So
for your sum fields it should be sum_in_base_units = 859 not 8.59. Decimal can
lose accuracy as you move around systems, it's most safe to just use base
units.

~~~
drdaeman
> Decimal can lose accuracy as you move around systems

Could you please provide an example? Given that Decimals are simplistically
represented as a tuple (sign, digits, exponent), I don't see how it's less
accurate than an int.

~~~
vertex-four
Simplest one: open up Python, enter:

    
    
        ((.1)*3)/3
    

It should come up as 0.10000000000000002. I honestly don't understand the
reason, though.

~~~
wldcordeiro
You're thinking of floats which are different than the Decimal type[1].

[https://docs.python.org/3/library/decimal.html?highlight=dec...](https://docs.python.org/3/library/decimal.html?highlight=decimal#module-
decimal)

