Include <cmath> for definition of std::sqrt and std::abs.