pendragon
Junior Contributor
I am a little confused as to how double type variables are handled and hope someone can explain to me what is happening. The problem breaks down to this
I have 3 doubles defined and there values are as follows
a = 52.77, b = 15.15 and c = 37.62
I first do a -= b and show the result for a in a message box, It equals 37.62
I then do a -= c and show the result for a in a message box, but instead of a equaling 0 it equals 7.105427357601e-15
If I do a = math.round(a - b,2) or change them from doubles to decimals then it is ok
I was just wondering why??
I have 3 doubles defined and there values are as follows
a = 52.77, b = 15.15 and c = 37.62
I first do a -= b and show the result for a in a message box, It equals 37.62
I then do a -= c and show the result for a in a message box, but instead of a equaling 0 it equals 7.105427357601e-15
If I do a = math.round(a - b,2) or change them from doubles to decimals then it is ok
I was just wondering why??