You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expect(received).toEqual(expected)
Expected value to equal:
0.33
Received:
0.32941176470588235
It would be interesting to get some more eyes on this issue. I've been using GDB to inspect the values in various places.
I found that in the PropertySetter the value was 0.33000000000000002 i.e. calling value->NumberValue() gave that number. This means that V8 is converting the 0.33 from the test-case's source code into 0.33000000000000002 as a c++ double.
After the GIRValue::ToGValue() calling g_value_get_double(&gvalue) returned the same 0.33000000000000002 value; this is good, at least our V8 -> GValue conversion is working as expected!
I believe the problem is in the PropertyGetter. After the call to g_object_get_property() a call to g_value_get_dobule(&gvalue) gives the value of 0.32941176470588235; this is the same number that the test case shows so we know that the GValue -> V8 conversion is working as well!
So, Is there a problem with precision or handling of V8 numbers, or does the window.opacity property do something funny under-the-hood in GTK land? I'm suspecting the latter is the case after my debugging session, but I don't want to change the test-case until we're sure! This is weird behaviour and we need to make sure it's not a bug with our bindings. If it's a bug with GTK, then that also sucks but at least we can push the work up-stream :D
The text was updated successfully, but these errors were encountered:
Related test case:
node-gir/__tests__/object_property.test.js
Line 54 in 6ab37ab
output:
It would be interesting to get some more eyes on this issue. I've been using GDB to inspect the values in various places.
I found that in the PropertySetter the value was
0.33000000000000002
i.e. calling value->NumberValue() gave that number. This means that V8 is converting the0.33
from the test-case's source code into0.33000000000000002
as a c++double
.After the
GIRValue::ToGValue()
callingg_value_get_double(&gvalue)
returned the same0.33000000000000002
value; this is good, at least our V8 -> GValue conversion is working as expected!I believe the problem is in the PropertyGetter. After the call to
g_object_get_property()
a call tog_value_get_dobule(&gvalue)
gives the value of0.32941176470588235
; this is the same number that the test case shows so we know that the GValue -> V8 conversion is working as well!So, Is there a problem with precision or handling of V8 numbers, or does the
window.opacity
property do something funny under-the-hood in GTK land? I'm suspecting the latter is the case after my debugging session, but I don't want to change the test-case until we're sure! This is weird behaviour and we need to make sure it's not a bug with our bindings. If it's a bug with GTK, then that also sucks but at least we can push the work up-stream :DThe text was updated successfully, but these errors were encountered: