Java Utililty Methods Number Sum

List of utility methods to do Number Sum

Description

The list of methods to do Number Sum are organized into topic(s).

Method

doublesum(double a, double b)
Make sum of two double values.
return a + b;
doublesum(double start, double end, double step)
sum
if (start > end) {
    throw new IllegalArgumentException("Lower limit > upper limit!");
} else if (start + step > end) {
    throw new IllegalArgumentException("Lower limit + step > upper limit!");
} else if (step <= 0) {
    throw new IllegalArgumentException("Step = 0!");
} else if (start == end) {
    return start;
...
doublesum(double x, double y)
Calculates sum of two doubles, but treats NaNs as zeros.
return Double.isNaN(x) ? y : Double.isNaN(y) ? x : x + y;
doublesum(double x, double y)
sum
return Double.isNaN(x) ? y : Double.isNaN(y) ? x : x + y;
doublesum(final Iterable values)
Calculates the sum of a Collection
double sum = 0;
for (final Double element : values) {
    sum += element;
return sum;
longsum(final Iterable ns)
sum
long res = 0;
for (final long n : ns) {
    res += n;
return res;
intsum(int a, int b)
sum
return a + b;
intsum(int matrix1, int matrix2)
sum
return matrix1 ^ matrix2;
doublesum(Iterable as)
The sum of a sequence of floating-point numbers
double sum = 0;
for (double a : as) {
    sum += a;
return sum;
intsum(Iterable iterable)
sum
int sum = 0;
for (int i : iterable) {
    sum += i;
return sum;