Absolute value in vexcode pro

I can not find how to do absolute value in vexcode. I am trying to make a PID loop, and I need it to find the absolute value of the error.

A quick google search reveals abs(); to be the desired command.

http://www.cplusplus.com/reference/cstdlib/abs/

If it gives you an error like “Can’t use double for int in function” or something like that, then use fabs(); and add the line
#include <math.h> with your includes.

3 Likes

Thank you. I knew that it was fabs-something. I forgot that I had to include the new math thing.

1 Like