Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-84061

Investigate NaN behavior in SBE

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • ALL
    • QE 2024-01-08, QE 2024-01-22

      When comparing two doubles, valueCompare will call compareDoubles in compare_numbers.h so two NaN's will compare equal to each other. https://github.com/mongodb/mongo/blob/e67290f658e1a8529935f3c842fe9c25ccf420bf/src/mongo/base/compare_numbers.h#L58

      When using genericCompare<std::equal_to<>>, no special case exists for NaN when both values are doubles, so it will fall back to using operator== for doubles. This means that when using genericCompare, NaN != NaN.
      https://github.com/mongodb/mongo/blob/e67290f658e1a8529935f3c842fe9c25ccf420bf/src/mongo/db/exec/sbe/vm/vm.h#L99

            Assignee:
            parker.felix@mongodb.com Parker Felix
            Reporter:
            parker.felix@mongodb.com Parker Felix
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: