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

Passing a Float to constructors of NumberInt()and NumberLong() give odd behavior

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.4.0
    • Component/s: JavaScript
    • Labels:
    • ALL

      Problem:

      Passing a flat into NumberInt() and NumberLong() has some inconsistent behavior.

      Correct:
      > r = NumberInt(-4.1);
      NumberInt(-4)
      > r = NumberLong(-4.1);
      NumberLong(-4)

      Incorrect:

      > r = NumberLong(Number.MIN_VALUE);
      NumberLong(0)
      > r = NumberLong(Number.MAX_VALUE);
      NumberLong("-9223372036854775808")

      > r = NumberInt(Number.MIN_VALUE);
      NumberInt(0)
      > r = NumberInt(Number.MAX_VALUE);
      NumberInt(0)

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            alvin Alvin Richards (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: