public static IntEx Sum <T>(this IEnumerable <T> source, Func <T, IntEx> select) { IntEx i = 0; foreach (var j in source) { i += select(j); } return(i); }
// // Zusammenfassung: // Berechnet die Summe einer Sequenz von System.Int64-Werten. // // Parameter: // source: // Eine Sequenz von System.Int64-Werten, deren Summe berechnet werden soll. // // Rückgabewerte: // Die Summe der Werte in der Sequenz. // // Ausnahmen: // T:System.ArgumentNullException: // source ist null. // // T:System.OverflowException: // Die Summe ist größer als System.Int64.MaxValue. public static IntEx Sum(this IEnumerable <IntEx> source) { IntEx i = 0; foreach (var j in source) { i += j; } return(i); }
internal static IntEx Abs(IntEx value) { if (value.IsNaN) { return(value); } if (value.IsInfinity) { return(IntEx.PositiveInfinity); } return((int)Math.Abs((long)value)); }