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

FIXMATH_FAST_SIN gives rounding error #24

Open
GoogleCodeExporter opened this issue Jan 25, 2016 · 1 comment
Open

FIXMATH_FAST_SIN gives rounding error #24

GoogleCodeExporter opened this issue Jan 25, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

I've found a bug with your fast implementation of sin() (FIXMATH_FAST_SIN), 
this bug doesn't happen with the more accurate version.
I made an animation of a rotating cube but noticed it would shudder, i tracked 
it down to the sin function providing very poor accuracy as the return value 
from it reached and passed 0.

I'm running it in Visual Studio 2009 and tracking the values in the debugger so 
the values i see are the 32bit number representation of the fix16_t variable 
but they go like this...
1842, 899, -74, -1055, -2037, -2990, -3979, all good so far, then suddenly it 
jumps back to positive with 4782, 3790, 2803, ... it then continues down 
through to -65536 (-1.0) as it should do.

Original issue reported on code.google.com by bynun...@gmail.com on 21 Apr 2013 at 12:58

@GoogleCodeExporter
Copy link
Author

In addition, each step i'm taking is (6.2832f / 500.0f) so a full rotation (1 
-> -1 -> 1) in 500 steps although it should be repeatable with any small step.

Original comment by bynun...@gmail.com on 21 Apr 2013 at 1:01

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

No branches or pull requests

1 participant