From e881754406b10c1e19b7c33756fbf04b51d73928 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 22 Jun 2010 22:30:52 -0700 Subject: SERVER-776 clean precision checking --- scripting/sm_db.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripting/sm_db.cpp') 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() ); -- cgit v1.2.1