Skip to content
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

double-precision properties fail to hold value through PropertySetter and PropertyGetter #2

Open
Place1 opened this issue Oct 31, 2017 · 0 comments

Comments

@Place1
Copy link
Owner

Place1 commented Oct 31, 2017

Related test case:

expect(win.opacity).toEqual(0.33);

output:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant