Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17549


Ignore:
Timestamp:
05/22/20 09:58:12 (5 years ago)
Author:
chaider
Message:

#2971 Updated root symbol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/Interval.cs

    r17547 r17549  
    262262      int higher = (int)Math.Round(b.UpperBound);
    263263
     264      //Root root(0,0) = 0
     265      if (a.LowerBound == 0 && b.LowerBound == 0 && lower == 0 && higher == 0)
     266        return new Interval(0, 0);
     267
     268      //Root is zero ==> undefined ==> 5^-(1.0/0)
     269      if (higher == 0 || lower == 0)
     270        return new Interval(double.NaN, double.NaN);
     271
     272      if (lower < 0 || higher < 0) {
     273        List<double> vals = new List<double>();
     274
     275        vals.Add(Math.Pow(a.LowerBound, 1.0 / lower));
     276        vals.Add(Math.Pow(a.LowerBound, 1.0 / higher));
     277
     278        vals.Add(Math.Pow(a.UpperBound, 1.0 / lower));
     279        vals.Add(Math.Pow(a.UpperBound, 1.0 / higher));
     280
     281        return new Interval(vals.Min(), vals.Max());
     282      }
     283
    264284      return new Interval(Math.Pow(a.LowerBound, 1.0 / higher), Math.Pow(a.UpperBound, 1.0 / lower));
    265      
    266285    }
    267286
Note: See TracChangeset for help on using the changeset viewer.