[SERVER-4141] NumberLong.bottom does not return values Created: 25/Oct/11 Updated: 07/Apr/23 Resolved: 27/Jan/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript, Shell |
| Affects Version/s: | 1.8.1, 2.0.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | 93e7a16c | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Done | Votes: | 3 |
| Labels: | mapreduce,, query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
db.version() 2.0.1 (linux) |
||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | Linux | ||||||||
| Participants: | |||||||||
| Description |
|
within the javascript shell several NumberLong.bottom, NumberLong.top does not return any value. s. while surrounding values seems correct. some more testcases: |
| Comments |
| Comment by Mira Carey [ 27/Jan/17 ] |
|
After our change to SpiderMonkey, I don't believe this problem exists anymore (those fields are now mediated by special member functions, rather than sometimes being filled and sometimes not). |
| Comment by Reuben Garrett [ 21/Dec/11 ] |
|
Convenience methods would be very helpful to perform arithmetic using, e.g., Google Closure's goog.math.Long. For example, bitsTop() could return 0 and bitsBottom() could return floatApprox for smaller values representable as 54-bit floats without loss of precision; otherwise, they could return top and bottom (respectively). |
| Comment by Antoine Girbal [ 02/Dec/11 ] |
|
we can improve the doc and add some convenience methods. |
| Comment by 93e7a16c [ 03/Nov/11 ] |
|
thank you for the Information. The distinction (if( top == null ) then value) can, of course, be done on application side. Without knowing those internal fields, working on a provided collection, there is no other way of evaluating arbitary stored 64bit values from NumberLong (afaik). For this I would like to vote, for having this fields externalized/documented. |
| Comment by Antoine Girbal [ 26/Oct/11 ] |
|
It only uses top/bottom in case it cannot exactly represent the long value using a double value. |
| Comment by 93e7a16c [ 25/Oct/11 ] |
|
approx. failure in 40 cases out of 50000 values. |