[SERVER-10966] Passing a Float to constructors of NumberInt()and NumberLong() give odd behavior Created: 30/Sep/13  Updated: 10/May/22

Status: Backlog
Project: Core Server
Component/s: JavaScript
Affects Version/s: 2.4.0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Alvin Richards (Inactive) Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Unresolved Votes: 0
Labels: 26qa, move-sa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-7812 NumberLong(max_of_int64) returns wron... Closed
Operating System: ALL
Participants:

 Description   

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)



 Comments   
Comment by Steven Vannelli [ 10/May/22 ]

Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions.

Generated at Thu Feb 08 03:24:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.