summaryrefslogtreecommitdiff
path: root/scripting/sm_db.cpp
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-06-22 22:30:52 -0700
committerAaron <aaron@10gen.com>2010-06-22 22:30:52 -0700
commite881754406b10c1e19b7c33756fbf04b51d73928 (patch)
tree864e21cbdf0d89daa72054f811602a49ece003e2 /scripting/sm_db.cpp
parentc00c7d6d93e9408eb09dfe1a9a68e824f0a024f1 (diff)
downloadmongo-e881754406b10c1e19b7c33756fbf04b51d73928.tar.gz
SERVER-776 clean precision checking
Diffstat (limited to 'scripting/sm_db.cpp')
-rw-r--r--scripting/sm_db.cpp8
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() );