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

    XMLWordPrintable

Details

    Description

      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.)

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                1 year, 7 weeks, 3 days ago