[SERVER-68233] MongoShell numberDecimalsAlmostEqual(NumberDecimal(0), NumberDecimal(0)) returns false Created: 22/Jul/22  Updated: 29/Oct/23  Resolved: 22/Aug/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.3, 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Denis Grebennicov Assignee: Denis Grebennicov
Resolution: Fixed Votes: 0
Labels: neweng, quick-tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0
Sprint: QE 2022-08-08, QE 2022-08-22
Participants:
Linked BF Score: 160

 Description   

Shell function `numberDecimalsAlmostEqual` returns false when passing two zeros as an input.

The reason for that is taking logarithm of the values, which is `NaN` for 0.

The whole approximated comparison algorithm works under assumption that these values are not zero.



 Comments   
Comment by Githook User [ 06/Oct/22 ]

Author:

{'name': 'Denis Grebennicov', 'email': 'denis.grebennicov@mongodb.com', 'username': 'denis631'}

Message: SERVER-68233 MongoShell numberDecimalsAlmostEqual(NumberDecimal(0), NumberDecimal(0)) returns false
Branch: v6.0
https://github.com/mongodb/mongo/commit/26350ca57b016f0fa755d4cd8034bf5e491242b2

Comment by Githook User [ 22/Aug/22 ]

Author:

{'name': 'Denis Grebennicov', 'email': 'denis.grebennicov@mongodb.com', 'username': 'denis631'}

Message: SERVER-68233 MongoShell numberDecimalsAlmostEqual(NumberDecimal(0), NumberDecimal(0)) returns false
Branch: master
https://github.com/mongodb/mongo/commit/02276ba2c720ae0060224df0348e08c31be764d5

Generated at Thu Feb 08 06:10:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.