• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

google / vector_math.dart / 12224890780

08 Dec 2024 08:11PM CUT coverage: 26.372%. Remained the same
12224890780

Pull #337

github

web-flow
Merge 1b1108c78 into 433fb6c82
Pull Request #337: Partial fix for benchmarks.

4325 of 16400 relevant lines covered (26.37%)

1.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/src/vector_math_64/error_helpers.dart
1
// Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
2
// All rights reserved. Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4

5
part of '../../vector_math_64.dart';
6

7
/// Returns relative error between [calculated] and [correct].
8
/// The type of [calculated] and [correct] must match and can
9
/// be any vector, matrix, or quaternion.
10
double relativeError(dynamic calculated, dynamic correct) {
×
11
  if (calculated is num && correct is num) {
×
12
    final diff = (calculated - correct).abs().toDouble();
×
13
    return diff / correct;
×
14
  }
15
  // avoiding an `as double` cast here to maximize speed on dart2js
16
  // ignore: avoid_dynamic_calls, return_of_invalid_type
17
  return calculated.relativeError(correct);
×
18
}
19

20
/// Returns absolute error between [calculated] and [correct].
21
/// The type of [calculated] and [correct] must match and can
22
/// be any vector, matrix, or quaternion.
23
double absoluteError(dynamic calculated, dynamic correct) {
×
24
  if (calculated is num && correct is num) {
×
25
    final diff = (calculated - correct).abs().toDouble();
×
26
    return diff;
27
  }
28
  // avoiding an `as double` cast here to maximize speed on dart2js
29
  // ignore: avoid_dynamic_calls, return_of_invalid_type
30
  return calculated.absoluteError(correct);
×
31
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc