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: http://v8.googlecode.com/svn/branches/bleeding_edge@11356 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
b2024c531c
commit
ac72f5c441
@ -228,9 +228,7 @@ double InternalStringToIntDouble(UnicodeCache* unicode_cache,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(number != 0);
|
ASSERT(number != 0);
|
||||||
// The double could be constructed faster from number (mantissa), exponent
|
return ldexp(static_cast<double>(negative ? -number : number), 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user