[SERVER-43034] Special values handling is inconsistent in DoubleDoubleSummation Created: 26/Aug/19  Updated: 29/Oct/23  Resolved: 02/Oct/19

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 3.6.15, 4.3.1, 4.2.2, 4.0.14

Type: Bug Priority: Major - P3
Reporter: Anton Korshunov Assignee: Geert Bosch
Resolution: Fixed Votes: 0
Labels: afz
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Tested
tested by SERVER-43764 Add more testing for special values i... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2, v4.0, v3.6
Steps To Reproduce:

TEST(Summation, ConvertSpecialToDecimal) {
    constexpr double infinity = std::numeric_limits<double>::infinity();
    DoubleDoubleSummation sum;
    
    sum.addDouble(infinity);    
    ASSERT_EQUALS(infinity, sum.getDouble()); // ok
    ASSERT_TRUE(sum.getDecimal().isInfinite()); // <-- fail here, it's nan
    ASSERT_FALSE(sum.getDecimal().isNaN()); // <!-- fail here, it is actually nan
    
    sum.addDouble(1); // now once we add something to sum, everything is ok
    ASSERT_EQUALS(infinity, sum.getDouble()); // ok, still infinity
    ASSERT_TRUE(sum.getDecimal().isInfinite()); // ok, now it's infinity
    ASSERT_FALSE(sum.getDecimal().isNaN()); // ok, not nan
}

Sprint: Execution Team 2019-10-07
Participants:
Linked BF Score: 12

 Description   

If the result of DoubleDoubleSummation is Infinity, it may return different special values depending on whether the result is converted to double or decimal.



 Comments   
Comment by Githook User [ 17/Oct/19 ]

Author:

{'username': 'GeertBosch', 'email': 'geert.bosch@mongodb.com', 'name': 'Geert Bosch'}

Message: SERVER-43034 Correctly deal with infinite results in DoubleDoubleSummation

(cherry picked from commit 9d31de1d5458e865439e643eb75f719d5217d064)
Branch: v4.0
https://github.com/mongodb/mongo/commit/8d959c8cd455cbf69c0c3681839695c0ebc25a84

Comment by Githook User [ 17/Oct/19 ]

Author:

{'username': 'GeertBosch', 'email': 'geert.bosch@mongodb.com', 'name': 'Geert Bosch'}

Message: SERVER-43034 Correctly deal with infinite results in DoubleDoubleSummation

(cherry picked from commit 9d31de1d5458e865439e643eb75f719d5217d064)
Branch: v4.2
https://github.com/mongodb/mongo/commit/5e9a5647539b661e00d9417face72abbaa289aa8

Comment by Githook User [ 17/Oct/19 ]

Author:

{'username': 'GeertBosch', 'email': 'geert.bosch@mongodb.com', 'name': 'Geert Bosch'}

Message: SERVER-43034 Correctly deal with infinite results in DoubleDoubleSummation

(cherry picked from commit 9d31de1d5458e865439e643eb75f719d5217d064)
Branch: v3.6
https://github.com/mongodb/mongo/commit/5e92879d28b0687bd4831180739dedb0c34eae4b

Comment by Githook User [ 02/Oct/19 ]

Author:

{'name': 'Geert Bosch', 'username': 'GeertBosch', 'email': 'geert.bosch@mongodb.com'}

Message: SERVER-43034 Correctly deal with infinite results in DoubleDoubleSummation
Branch: master
https://github.com/mongodb/mongo/commit/9d31de1d5458e865439e643eb75f719d5217d064

Generated at Thu Feb 08 05:02:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.