Line data Source code
1 : // Copyright 2023 The terCAD team. All rights reserved.
2 : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
3 :
4 : import 'dart:math' as math;
5 :
6 : extension IntExt on double {
7 0 : double toFixed(int? digits) => (this * math.pow(10, digits ?? 8)).round() / math.pow(10, digits ?? 8);
8 :
9 0 : bool isEqual(double? value) => (this - (value ?? 0)).abs() < 1e-10;
10 :
11 0 : bool isNotEqual(double? value) => !isEqual(value);
12 : }
|