std::abs replaced by std::fabs for distance in digit sampling