Sum of Negatives number wrong result

Hi,
i’m doing this sample operation:
sum1=-0,53
sum2=0,48
sum3=0,05
Then return sum1+sum2+sum3 and the result should be 0. But the result is -4.16333634234434E-17.

what type are sum1,sum2,sum3 and sum this might be a problem with doubles or floats
you could try change them all to decimals but not sure if it will help

They are doubles

did you try changing them to the type “decimal” and did this help?

Done thanks now it works i’ll test it more

Hi @Mustafa_Hamed

Check this

DataTableName.AsEnumerable.Sum(Function(x) If(IsNumeric(x(“Amount”).ToString.Trim),CDbl(x(“Amount”).ToString.Trim),0))

Th@nks
@shwin.S