Changed from abs to fabs (double return value as opposed to int)