we have following data and when we call SUM over those values gives different result
[
{
“amount”: 100 },
{
“amount”: 7000
},
{
“amount”: 400
},
{
“amount”: 9880
},
{
“amount”: 700
},
{
“amount”: 0.01
},
{
“amount”: 0
},
{
“amount”: 100
},
{
“amount”: 9000
},
{
“amount”: 0
},
{
“amount”: 18
},
{
“amount”: 200
},
{
“amount”: 200
},
{
“amount”: 0.1
},
{
“amount”: 0
},
{
“amount”: 0.009
},
{
“amount”: 99
},
{
“amount”: 32755
},
{
“amount”: 14620
},
{
“amount”: 15200
},
{
“amount”: 1023
},
{
“amount”: 200
},
{
“amount”: 3211
},
{
“amount”: 1220
},
{
“amount”: 90000
}
]
the query is
select sum(case move_type when 'outcome' then a.amount * -1 else a.amount end ) s from `safety-checklist` as a where model = 'stockmove'
the results are:
12110.118999999991
12110.119000000006
12110.118999999998
how we should sum up our stored values correctly?