[DOCS-5400] Explain how $mod handles negative numbers Created: 08/May/15 Updated: 30/Oct/23 Resolved: 01/Nov/22 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual, Server |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Docs Collector User (Inactive) | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | bite-sized, docs-triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Location: http://docs.mongodb.org/manual/reference/operator/aggregation/mod/#exp._S_mod |
||
| Participants: | |
| Days since reply: | 1 year, 14 weeks, 1 day ago |
| Epic Link: | DOCSP-1769 |
| Story Points: | 0.25 |
| Description |
|
The $mod function doesn't describe how it behaves for negative numbers. What's -1 % 10, for example? Programming languages are generally split on how to answer this question. Python and Ruby say 9, while Java and C say -1. A nonnegative result is arguably more (mathematically) correct, but MongoDB generally follows Javascript, so maybe it gives -1 here? Whichever one MongoDB does today, I can figure out by trial-and-error, but since it's not documented, is it guaranteed to be stable? |
| Comments |
| Comment by Education Bot [ 01/Nov/22 ] |
|
Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you! |