I'm calculating with variables by multiplicating etc and I noticed this strange behavior.
If I use these calculations:
CD = 6
CDR = 0.4
CD = float(CD) - (float(CDR) * float(CD))
Theoretically that would be 6 - (6 * 0.4) = 6 - 2.4 = 3.6 if I then print(CD) it prints
3.5999999999999996
Is there a reason for this which I can avoid? Is there a way, like math.ceil to round up the number but to a certain decimal, for example to x.xxxxx (5th deciamal)?
(Let me know if I did anything wrong in this post, I find answers on this site since a while but have never posted before so I maybe did something wrong, apologies in advance.)