absoluteError function

double absoluteError (dynamic calculated, dynamic correct)

Returns absolute error between calculated and correct. The type of calculated and correct must match and can be any vector, matrix, or quaternion.


double absoluteError(dynamic calculated, dynamic correct) {
  if (calculated is num && correct is num) {
    final double diff = (calculated - correct).abs().toDouble();
    return diff;
  // ignore: return_of_invalid_type
  return calculated.absoluteError(correct);