Added <cmath> and std:: for fabs()