use fabs() instead of abs()