Changeset 17300 for branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Timestamp:
- 10/03/19 10:27:12 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/Interval.cs
r17210 r17300 38 38 39 39 public Interval(double lowerBound, double upperBound) { 40 //TODO Handle floating point issues where lowerbound is bigger than upperbound in the nth decimal place 40 //TODO Handle floating point issues where lowerbound is bigger than upperbound in the nth decimal place 41 41 if (lowerBound > upperBound) 42 42 throw new ArgumentException("lowerBound must be smaller than or equal to upperBound."); … … 264 264 265 265 public static Interval CubicRoot(Interval a) { 266 if (a.LowerBound < 0) return new Interval(double.NaN, double.NaN); 267 return new Interval(Math.Pow(a.LowerBound, 1.0/3), Math.Pow(a.UpperBound, 1.0/3)); 266 var lower = (a.LowerBound < 0) ? -Math.Pow(-a.LowerBound, 1d / 3d) : Math.Pow(a.LowerBound, 1d / 3d); 267 var upper = (a.UpperBound < 0) ? -Math.Pow(-a.UpperBound, 1d / 3d) : Math.Pow(a.UpperBound, 1d / 3d); 268 269 return new Interval(lower, upper); 268 270 } 269 271 #endregion
Note: See TracChangeset
for help on using the changeset viewer.