When I try to get the difference between two apparently equal numbers, I get a number different than zero.
product_price min_product_price price_dif
40,609756097561 40,609756097561 -2,1316282072803E-14
I understand this can be a difficult question to answer without all the queries that lead to this, but I’ll try to explain,
product_price comes straight from the ERP database.
min_product_price is obtained with a
MIN(ItemSellingPrices.UnitPrice) as min_product_price
together with a group by clause. Shouldn’t this mean the numbers are the same?
I have no experience with this kind of issues, so I apologize if this is too basic.
Looks like a floating point issue.
If you’re storing money values in
floatorrealcolumns, try using adecimal/numericdata type instead.For storing 12 decimal values, you could use
decimal(18, 12), for example.