-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
assert.deepEqual is broken? #5907
Labels
Comments
This happens due to this line, where typed arrays are converted to assert.deepEqual(new Float32Array([ 0 ]), new Float32Array([ 255 ])) // throws
assert.deepEqual(new Float32Array([ 0 ]), new Float32Array([ 256 ])) // passes, 256 becomes 0x00
assert.deepEqual(new Float32Array([ 0 ]), new Float32Array([ 257 ])) // throws Same with |
3 tasks
addaleax
added a commit
to addaleax/node
that referenced
this issue
Mar 31, 2016
Do not convert typed arrays to `Buffer` for deepEqual since their values may not be accurately represented by 8-bit ints. Instead perform binary comparison of underlying `ArrayBuffer`s, but only when the array types match. Never apply any kind of optimization for floating-point typed arrays since bit pattern equality is not the right kind of check for them. PR-URL: nodejs#5910 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Fixes: nodejs#5907
MylesBorins
pushed a commit
that referenced
this issue
Apr 5, 2016
Do not convert typed arrays to `Buffer` for deepEqual since their values may not be accurately represented by 8-bit ints. Instead perform binary comparison of underlying `ArrayBuffer`s, but only when the array types match. Never apply any kind of optimization for floating-point typed arrays since bit pattern equality is not the right kind of check for them. PR-URL: #5910 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Fixes: #5907
addaleax
added a commit
to addaleax/node
that referenced
this issue
Apr 11, 2016
Do not convert typed arrays to `Buffer` for deepEqual since their values may not be accurately represented by 8-bit ints. Instead perform binary comparison of underlying `ArrayBuffer`s, but only when the array types match. Never apply any kind of optimization for floating-point typed arrays since bit pattern equality is not the right kind of check for them. PR-URL: nodejs#5910 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Fixes: nodejs#5907
3 tasks
MylesBorins
pushed a commit
that referenced
this issue
Apr 11, 2016
Do not convert typed arrays to `Buffer` for deepEqual since their values may not be accurately represented by 8-bit ints. Instead perform binary comparison of underlying `ArrayBuffer`s, but only when the array types match. Never apply any kind of optimization for floating-point typed arrays since bit pattern equality is not the right kind of check for them. PR-URL: #5910 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Fixes: #5907
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Problem:
Does not throw an exception, when comparing two Float32Array which have the small different values.
This works as expected.
The text was updated successfully, but these errors were encountered: