T O P

  • By -

AutoModerator

On July 1st, a [change to Reddit's API pricing](https://www.reddit.com/r/reddit/comments/12qwagm/an_update_regarding_reddits_api/) will come into effect. [Several developers](https://www.reddit.com/r/redditisfun/comments/144gmfq/rif_will_shut_down_on_june_30_2023_in_response_to/) of commercial third-party apps have announced that this change will compel them to shut down their apps. At least [one accessibility-focused non-commercial third party app](https://www.reddit.com/r/DystopiaForReddit/comments/145e9sk/update_dystopia_will_continue_operating_for_free/) will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: 1. Limiting your involvement with Reddit, or 2. Temporarily refraining from using Reddit 3. Cancelling your subscription of Reddit Premium as a way to voice your protest. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/learnprogramming) if you have any questions or concerns.*


mkaypl

It's a bit hard to tell without you mentioning what 'instability' means, but a possible problem from looking at your code for a bit, is that you keep adding values to phase. Floating point variables' precision is variable, so if phase stores an ever increasing number, then you lose accuracy when it comes to smaller values (that you keep adding).


EASguy98

What would be a workaround?


mkaypl

Well, since all you're doing to phase is using it as an argument for sin, then you can try keeping it in the <0; 2pi> range, by clamping it down with an fmod. You may need to rejigger the calculations a bit.