Reviewers: Yang,

Message:
Based on patch by Jonathan Liu <[email protected]>. LGTM.

Description:
Use ldexp instead of pow for more accuracy.

Original patch by [email protected]:
https://chromiumcodereview.appspot.com/10026011/

BUG=
TEST=cctest/test-conversions/Octal


Please review this at https://chromiumcodereview.appspot.com/10103030/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/conversions-inl.h


Index: src/conversions-inl.h
diff --git a/src/conversions-inl.h b/src/conversions-inl.h
index b098a1c29c1022e1c03057a58e319e5740af0e50..77b260f036483962892a88ec04f46624fca30aec 100644
--- a/src/conversions-inl.h
+++ b/src/conversions-inl.h
@@ -228,9 +228,7 @@ double InternalStringToIntDouble(UnicodeCache* unicode_cache,
   }

   ASSERT(number != 0);
- // The double could be constructed faster from number (mantissa), exponent
-  // and sign. Assuming it's a rare case more simple code is used.
- return static_cast<double>(negative ? -number : number) * pow(2.0, exponent);
+  return ldexp(static_cast<double>(negative ? -number : number), exponent);
 }




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to