the issue is that double is floating point number, but in base 2 instead of base 10. you probably know in base 10, 1/3 = .33333..... in base 2 there are other repeating numbers. 1/10 in base 2 is a repeating number. which make floating bad for money calculations.

the decimal datatype gets around this but storing a numeric value and an implied decimal point. The math operations are done as integer match, than rounded to the scaling factor

the usual fix if using floating point is to first multiple by the scaling factor (number of decimal places you want), do the calc and then divide by the scale factor.