[DOCS-4657] $mul example seems to advocate using floating point for currency Created: 13/Jan/15  Updated: 30/Oct/23  Resolved: 16/Mar/18

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Graham Lowe (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 5 years, 47 weeks, 5 days ago

 Description   

See http://docs.mongodb.org/manual/reference/operator/update/mul/#multiply-the-value-of-a-field

The example uses a document with the structure:

{ _id: 1, item: "ABC", price: 10.99 }

While the result of the $mul operator results in an obviously incorrect price value, we don't explain why it might not be a good idea to use floating point as a representation of price. Perhaps the message is too subtle?

See http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency



 Comments   
Comment by Kay Kim (Inactive) [ 16/Mar/18 ]

https://github.com/mongodb/docs/commit/9e3d21ca9a42afad8855fbe4e6e180b186b5c806

Generated at Thu Feb 08 07:48:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.