I have the following C++ code:
#include #include // per http://www.cplusplus.com/reference/clibrary/cmath/abs/ // snip .
Use fabs() instead of abs(), it's the same but for floats instead of integers.