leandro.martins Posted January 17, 2022 Share Posted January 17, 2022 I am implementing a servo algorithm in C and it's necessary a sign function: sgn(x)=-1, if x<0 sgn(x)=0, if x=0 sgn(x)=1, if x>0 Since this logic is used in the ServoCtrl algorithm in the Kfff gain, is there any better manner than an if-else statement? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.