Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14850 for stable


Ignore:
Timestamp:
04/11/17 17:28:08 (8 years ago)
Author:
mkommend
Message:

#2746: Merged r14750, r14769 into stable.

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Common/3.3/EnumerableExtensions.cs

    r13953 r14850  
    120120
    121121      for (int i = 0; i < length; ++i) {
    122         yield return range.Select(x => elements[x]);
     122        yield return range.Select(x => elements[x]).ToArray();
    123123
    124124        if (i == length - 1) break;
     
    150150      if (k > n - k)
    151151        k = n - k;
    152       long r = 1;
    153       for (long d = 1; d <= k; d++) {
    154         r *= n--;
    155         r /= d;
     152
     153      // enable explicit overflow checking for very large coefficients
     154      checked {
     155        long r = 1;
     156        for (long d = 1; d <= k; d++) {
     157          r *= n--;
     158          r /= d;
     159        }
     160        return r;
    156161      }
    157       return r;
    158162    }
    159163  }
Note: See TracChangeset for help on using the changeset viewer.