Changeset 11974 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Common/Extensions.cs
- Timestamp:
- 02/10/15 02:05:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Common/Extensions.cs
r11846 r11974 7 7 namespace HeuristicLab.Common { 8 8 public static class Extensions { 9 9 10 10 public static bool IsAlmost(this double x, double y) { 11 if (double.IsNaN(x) || double.IsNaN(y)) return false; 12 if (double.IsPositiveInfinity(x) && double.IsPositiveInfinity(y)) return true; 13 if (double.IsNegativeInfinity(x) && double.IsNegativeInfinity(y)) return true; 11 14 return Math.Abs(x - y) < 1.0e-12; 12 15 }
Note: See TracChangeset
for help on using the changeset viewer.