[SERVER-3682] v1 index equality comparison does not compare positive and negative zero as equal Created: 24/Aug/11  Updated: 11/Jul/16  Resolved: 29/Aug/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0-rc1

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

We just check equality of doubles using their bits, but +/- 0 have different bit representations and should compare equal.

case coid:
if( ((unsigned) l) != ((unsigned) r) )
return false;
l += 4; r += 4;
case cdate:
case cdouble:
if( *((unsigned long long *) l) != *((unsigned long long *) r) )
return false;
l += 8; r += 8;
break;

I wrote a test, will push it once buildbot is working.



 Comments   
Comment by auto [ 29/Aug/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: fix double comparision of -0 and 0 for v1 indexes SERVER-3682
Branch: master
https://github.com/mongodb/mongo/commit/cbba880bd437449490c70dc4c4c00d6aa2930c24

Comment by auto [ 24/Aug/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3682 test
Branch: master
https://github.com/mongodb/mongo/commit/cad7aba1d3e336654e86eb5001d1667cde022b10

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