[SERVER-19627] Add experimental Decimal128 data type support to the MongoDB shell as NumberDecimal Created: 28/Jul/15 Updated: 03/Nov/16 Resolved: 13/Aug/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 3.1.7 |
| Fix Version/s: | 3.1.7 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Raymond Jacobson | Assignee: | Raymond Jacobson |
| Resolution: | Done | Votes: | 0 |
| Labels: | dnsf | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Add support for both v8-3.12 and mozjs. Note: Do not support shell arithmetic operations for NumberDecimal data type. Currently shell arithmetic on NumberLong functions on a float approx., which is not suitable for precise decimal data types. |
| Comments |
| Comment by Max Hirschhorn [ 03/Nov/16 ] | ||||||
This isn't entirely accurate, as it is possible to inject additional C++ functions to add/subtract/etc. NumberLong and NumberDecimal instances. What isn't possible is to get it to work with the + operator because the valueOf() method will convert to a Number instance. Defining an alternate syntax is what SERVER-14217 and | ||||||
| Comment by Geert Bosch [ 03/Nov/16 ] | ||||||
|
Indeed, we cannot. JavaScript, the language, does not make it possible to implement support for numeric types other than double. See:
The arithmetic is performed using double precision floating point, and the result is no longer a NumberLong. This is already confusing and error-prone for NumberLong for people using numbers larger than 2**53. However, for NumberDecimal, we'd get subtly wrong results all the time. This is the reason we don't silently convert NumberDecimal to double precision in the shell. | ||||||
| Comment by Buzz Moschetti [ 03/Nov/16 ] | ||||||
|
geert.bosch Do we still not support NumberDecimal math in the shell? | ||||||
| Comment by Githook User [ 13/Aug/15 ] | ||||||
|
Author: {u'username': u'raymondjacobson', u'name': u'Raymond Jacobson', u'email': u'raymond.jacobson@10gen.com'}Message: |