Permalink
Browse files

Use ldexp instead of pow for more accuracy.

Original patch by net147@gmail.com: https://chromiumcodereview.appspot.com/10026011/

BUG=
TEST=cctest/test-conversions/Octal

Review URL: https://chromiumcodereview.appspot.com/10103030

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@11356 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
  • Loading branch information...
1 parent d70d0d9 commit d9ee1e21044d4e97d6445c849a4979b14dd93a08 yangguo@chromium.org committed Apr 17, 2012
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/conversions-inl.h
View
4 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);
}

0 comments on commit d9ee1e2

Please sign in to comment.