[SERVER-19676] NumberDecimal(...) + NumberDecimal(...) should not cause string concatentation Created: 13/Jul/15 Updated: 05/Apr/17 Resolved: 13/Feb/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | David Hatch | Assignee: | Mira Carey |
| Resolution: | Done | Votes: | 1 |
| Labels: | decimal-data-type | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Sprint: | Platforms 2017-01-23, Platforms 2017-02-13 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Comments |
| Comment by Mira Carey [ 13/Feb/17 ] | |||||||
|
Due to the fundamental problems inherent to doing non-floating point math in javascript, there isn't any easy system to hook into to provide arithmetic support for our types. If/when javascript provides operator overloading, or something that looks more live value types, we may revisit the issue. In the meantime, we aren't planning on re-implementing arithmetic via methods. | |||||||
| Comment by Geert Bosch [ 25/Jul/16 ] | |||||||
|
JS fundamentally only supports double as numerical type.
Rather providing operators that appear to work on NumberDecimal, but throw away most of the precision and result in inaccurate results, the mongo shell does not support any numerical operations on NumberDecimal. It is possible to compute expressions using NumberDecimal using the MongoDB query and aggregation language though, and these operations are performed accurately using the full precision of the NumberDecimal type. | |||||||
| Comment by Raymond Jacobson [ 12/Aug/15 ] | |||||||
|
var x = {} .compare has been implemented on NumberLong in the shell. Operations such as .add, .mul, etc. could be implemented on NumberLong & NumberDecimal as well. |