Add a C++ relative_error function