0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

fix double comparision of -0 and 0 for v1 indexes SERVER-3682

This commit is contained in:
Eliot Horowitz 2011-08-29 11:41:16 -04:00
parent a61217961f
commit cbba880bd4
2 changed files with 5 additions and 3 deletions

View File

@ -602,11 +602,15 @@ namespace mongo {
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;
case cdouble:
if( *((double *) l) != *((double *) r) )
return false;
l += 8; r += 8;
break;
case cstring:
{
unsigned sz = ((unsigned) *l) + 1;

View File

@ -1602,7 +1602,6 @@
class SignedZeroDuplication : public Base {
public:
void run() {
if ( 0 ) { // SERVER-3682
ASSERT_EQUALS( 0.0, -0.0 );
DBDirectClient c;
c.ensureIndex( ns(), BSON( "b" << 1 ), true );
@ -1610,7 +1609,6 @@
c.insert( ns(), BSON( "b" << 1.0 ) );
c.update( ns(), BSON( "b" << 1.0 ), BSON( "b" << -0.0 ) );
ASSERT_EQUALS( 1U, c.count( ns(), BSON( "b" << 0.0 ) ) );
}
}
};