Jump to content

blastframe

Timeline key value different than Python

Recommended Posts

Hello,
I am using  CKey.GetValue() to get the value of a CCurve's key. In Python, the result is -2.9802322387695312e-08, but when I look at the key in the Timeline or Attribute views, the value is 0. It's driving me crazy...even when I convert the value to degrees (in the case of rotation radians), the GetValue() value is different.

 

Capture.thumb.PNG.3631f47d818ac68eb8ba312fe18f7ed7.PNG

 

Can anyone please shed light on what is happening and how I may get these values to match?

 

Thank you!

Share this post


Link to post
Share on other sites

10 ^ -8 is effectively zero. What you are seeing is the so-called floating point error. Python doesn't store numbers the way humans think, and so you sometimes get these little quirks. I guess you could fix this 'error' with something like round(x, 2), but it's not usually recommended.

 

There's discussions at stackoverflow if you google 'floating point error'. I only clean up numbers for display purposes - not in calculations.

 

false.thumb.png.5f1a277a170092cab9dfc65f680cb79a.png

 

from https://docs.python.org/3/tutorial/floatingpoint.html

 

LOL, as they say...

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×