So I notice the problem was happened because I multiply my angle with PI_RADIAN. This is a must since cos function input a radian value. Instead of having half of the radian, I got 'almost' half of it. And when I use it in cos function, I did not give me 0.
I haven't figure out how to handle this problem but first thing I want to do is to find out how to cut the decimal precision of float. I will update this post as soon as I got the solution.
Update: fortunately, I use lookup table for sin and cos value. Apparently the only way to handle this is to either convert to string and cut it (there's a smart way of doing this), or multiply by 10^(significant number) convert to int, and divide by the same 10 multiplication. Its quite too many ways for doing a real time calculation so try to trick it out.
1 comment:
coba yah, yg dibahas yg lebih manusiawi. :))
Post a Comment