fabs is changed to std::abs