Changeset 5739
- Timestamp:
- 03/17/11 16:30:37 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Common/3.3/DoubleExtensions.cs
r5705 r5739 24 24 public static class DoubleExtensions { 25 25 public static bool IsAlmost(this double x, double y) { 26 if (double.IsPositiveInfinity(x)) return double.IsPositiveInfinity(y); 27 if (double.IsNegativeInfinity(x)) return double.IsNegativeInfinity(y); 28 29 return Math.Abs(x - y) < 1.0E-12; 26 if (double.IsInfinity(x)) { 27 if (x > 0) return double.IsPositiveInfinity(y); 28 else return double.IsNegativeInfinity(y); 29 } else { 30 return Math.Abs(x - y) < 1.0E-12; 31 } 30 32 } 31 33 }
Note: See TracChangeset
for help on using the changeset viewer.