ES6-study-notes icon indicating copy to clipboard operation
ES6-study-notes copied to clipboard

关于数字V8引擎编译和执行造成的计算不同考虑为bug

Open wudifeixue opened this issue 7 years ago • 1 comments

其实就是这个例子,

Math.pow(99, 99)
// 3.697296376497263e+197
99 ** 99
// 3.697296376497268e+197

由于**是在编译时计算,而Math.pow是在执行时间计算,导致结果不同。 举例:

x = 99, y = 99;
x ** y;
// 3.697296376497263e+197

但是这是不应该的,答案不同是错误表现。现在已经有人给V8提交bug

wudifeixue avatar Apr 16 '17 18:04 wudifeixue

其实是常量折叠的优化手段引起的,这个BUG也许V8不会做出处理,期待以后版本更新吧

porcelainHeart avatar Apr 17 '17 01:04 porcelainHeart