-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Float numbers not pushed into array. #15427
Comments
Simplified case: 'use strict';
var ar = new Array(5);
ar.push(1);
console.log(ar);
ar.shift();
console.log(ar);
ar.push(2);
console.log(ar);
ar.shift();
console.log(ar);
ar.push(0.3);
console.log(ar);
ar.shift();
console.log(ar); [ <5 empty items>, 1 ]
[ <4 empty items>, 1 ]
[ <4 empty items>, 1, 2 ]
[ <3 empty items>, 1, 2 ]
[ <3 empty items>, 1, 2, 0.3 ]
[ <3 empty items>, 1, 2 ] |
This is fixed in V8 6.1. |
/cc @nodejs/v8 |
Even more simplified case: var ar = [, , 0.1];
ar.shift();
console.log(ar); [ <2 empty items> ] So the issue is: |
@vsemozhetbyt I don't think so, because is you look into my example there were some integers before floats and they were not shifted. Also:
|
Yes, it seems for arrays with an initial hole and a non-SMI number, const a = [ , 2**31, 1 ];
a.shift();
console.log(a); // [ <1 empty item>, 2147483648 ] |
The commit message here looks like it could be fixing this: v8/v8@81778aa |
a variant of |
v8/v8@81778aa was actually merged to V8 6.1 so this issue is fixed on |
v8.7.0 was released with V8 6.1, which has the fix. I'll close this out. |
In two words: float numbers not pushed into array if in push function shift is called.
Version: 8.5.0
Platform: linux x86_64
Result:
Here's the code that stopped working in 8.5.0, but it was working in 8.4.0.
There's a class
FixedArray
that basically overrides push method. When I try to push float value into such array it pushes only once, however it should be pushed every second.Another strange thing is if you change it to
ddd.push(5);
it works normally and integer value is pushed into this array every second.If you remove
shift()
from a push, then all works also normally.PS: In chrome versions from 60 to 63 all works normally.
The text was updated successfully, but these errors were encountered: