Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-14006

Investigate changes in SERVER-50445: Return the value as double when NumberLong subtraction overflows in ExpressionSubtract

      Description

      Downstream Change Summary

      Similar to what we have mentioned for $pow, we should update the docs for $sum and $subtract to describe the overflow behaviour.

      The result will have the same type as the input except when it cannot be represented accurately in that type. In these cases:

      A 32-bit integer will be converted to a 64-bit integer if the result is representable as a 64-bit integer.
      A 32-bit integer will be converted to a double if the result is not representable as a 64-bit integer.
      A 64-bit integer will be converted to double if the result is not representable as a 64-bit integer.

      Description of Linked Ticket

      The ExpressionSubtract does subtract operation on two long long data type. This can cause an overflow with large numbers. The right way to do this is to use the DoubleDoubleSummation helper that we use while adding number in ExpressionSum.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            andrew.feierabend@mongodb.com Andrew Feierabend (Inactive)
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              2 years, 50 weeks, 5 days ago