In my game, I need to ensure that angles do not exceed 2 pi. so I use fmod(angle,TWO_PI);
Is this noticeably expensive to do about 100 times per second?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
100 times per second? That’s almost zero, you shouldn’t trouble yourself.
Even if fmod takes 100 clock cycles – that’s 10,000 cycles/Sec. For 1 1GHz CPU – that’s 0.001% CPU.
BTW: why do you want to do fmod of TWO_PI? If you’re going to take sin() or cos() – you can skip it.