added std:: namespace specification to use double abs(double)