relativeError function
Returns relative error between calculated
and correct
.
The type of calculated
and correct
must match and can
be any vector, matrix, or quaternion.
Implementation
double relativeError(dynamic calculated, dynamic correct) {
if (calculated is num && correct is num) {
final diff = (calculated - correct).abs().toDouble();
return diff / correct;
}
// ignore: return_of_invalid_type
return calculated.relativeError(correct);
}