Details
-
Bug
-
Resolution: Not a Bug
-
Major
-
5.5.2
-
None
-
Untriaged
-
Unknown
Description
I was running the Couchmart Demo on 5.5.2 I have a simple data set where every product has a price recorded to 2 decimal places, see sample doc below. I put the keys of 5 such documents in a shopping basket and run a query to sum the price of this basket. The price occasionally comes back with an incorrectly rounded total (see below). I have attached a backup of the complete (small) dataset.
Sample Product Document:
{
|
"category": "british",
|
"product": "scotch egg",
|
"name": "scotch egg",
|
"productList": {
|
"owner": "david",
|
"id": "david.all_the_products"
|
},
|
"price": 0.36,
|
"description": "Perfect for picnics - a boiled egg, shrouded in meat and breadcrumbs",
|
"complete": false,
|
"type": "product",
|
"image": "scotch_egg.png",
|
"createdAt": 12022,
|
"stock": 100
|
}
|
SUM query:
SELECT b.name name, SUM(a.price) price, b.`order` basket FROM couchmart b
|
JOIN couchmart a ON KEYS b.`order`
|
WHERE b.type="order"
|
GROUP BY meta(b).id,b.name,b.`order`
|
ORDER BY price DESC
|
LIMIT 10
|
Result with incorrect rounding:
{
|
"basket": [
|
"product:milk",
|
"product:scotch egg",
|
"product:cheese",
|
"product:sausages",
|
"product:eggs"
|
],
|
"name": "David",
|
"price": 9.600000000000001
|
}
|
Attachments
Issue Links
- links to