Changeset 17301


Ignore:
Timestamp:
10/03/19 12:14:19 (11 days ago)
Author:
chaider
Message:

#3032 Fixed calculation problems for negative interval boundaries in cubic root

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs

    r17180 r17301  
    226226
    227227    public static Interval CubicRoot(Interval a) {
    228       if (a.LowerBound < 0) return new Interval(double.NaN, double.NaN);
    229       return new Interval(Math.Pow(a.LowerBound, 1.0/3), Math.Pow(a.UpperBound, 1.0/3));
     228      var lower = (a.LowerBound < 0) ? -Math.Pow(-a.LowerBound, 1d / 3d) : Math.Pow(a.LowerBound, 1d / 3d);
     229      var upper = (a.UpperBound < 0) ? -Math.Pow(-a.UpperBound, 1d / 3d) : Math.Pow(a.UpperBound, 1d / 3d);
     230
     231      return new Interval(lower, upper);
    230232    }
    231233    #endregion
Note: See TracChangeset for help on using the changeset viewer.