diff options
author | Aaron <aaron@10gen.com> | 2010-06-22 22:30:52 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-06-22 22:30:52 -0700 |
commit | e881754406b10c1e19b7c33756fbf04b51d73928 (patch) | |
tree | 864e21cbdf0d89daa72054f811602a49ece003e2 /scripting/sm_db.cpp | |
parent | c00c7d6d93e9408eb09dfe1a9a68e824f0a024f1 (diff) | |
download | mongo-e881754406b10c1e19b7c33756fbf04b51d73928.tar.gz |
SERVER-776 clean precision checking
Diffstat (limited to 'scripting/sm_db.cpp')
-rw-r--r-- | scripting/sm_db.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripting/sm_db.cpp b/scripting/sm_db.cpp index 6d9f7d551bb..d8d5bd479cd 100644 --- a/scripting/sm_db.cpp +++ b/scripting/sm_db.cpp @@ -735,11 +735,11 @@ namespace mongo { JSBool numberlong_tostring(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval){ Convertor c(cx); stringstream ss; - long long val = c.toNumberLongUnsafe( obj ); - if ( val == (long long)(double)( val ) ) { - ss << "NumberLong( " << double( val ) << " )"; - } else { + if ( c.hasProperty( obj, "top" ) ) { + long long val = c.toNumberLongUnsafe( obj ); ss << "NumberLong( \"" << val << "\" )"; + } else { + ss << "NumberLong( " << c.getNumber( obj, "floatApprox" ) << " )"; } string ret = ss.str(); return *rval = c.toval( ret.c_str() ); |