fix cpp wrong result, replace abs by fabs