# How do I make a sine wave without using an infinitely-increasing time value as input?

I have a basic understanding of sine wave generation. The problem I am facing is that as the input parameter for time gets larger, my sine wave falls apart and starts to look really ugly.

I'd like to calculate a sine wave without depending on an ever increasing time value. How can I do this?

if(time > 2*pi)

If is still okay to increase your time variable infinitely but the input for the sine is to large, just use fmod(time, 2*pi).
• basically it returns r in the equation x = n*y + r where x and y are the inputs and n is an integer. – ratchet freak Sep 5 '15 at 18:25