3 ms·
> 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
by drdaeman 12y ago
> 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 12y agoSimplest one: open up Python, enter: ((.1)*3)/3 It should come up as 0.10000000000000002. I honestly don't understand the reason, though.
- detaro 12y agoThese are normal floats, not Decimals, which are Python's exact floating point type.
- wldcordeiro 12y agoYou're thinking of floats which are different than the Decimal type[1]. https://docs.python.org/3/library/decimal.html?highlight=decimal#module-decimal https://docs.python.org/3/library/decimal.html?highlight=dec...