Summiert den uebergebenen Summanden und liefert als Ergebnis eine neue
{@link PackedDecimal} zurueck

@param summand Operand
@return Differenz
353464
public PackedDecimal add(BigDecimal summand) {
        BigDecimal summe = toBigDecimal().add(summand);
        return PackedDecimal.valueOf(summe);
    }
263728
@Override
  public void put(Mean other) {
    if(!(other instanceof StatisticalMoments)) {
      throw new IllegalArgumentException("I cannot combine Mean or MeanVariance into to a StatisticalMoments class.");
    }
    if(other.n == 0.) {
      return;
    }
    StatisticalMoments othe = (StatisticalMoments) other;
    if(this.n == 0.) {
      this.n = othe.n;
      this.sum = othe.sum;
      this.m2 = othe.m2;
      this.m3 = othe.m3;
      this.m4 = othe.m4;
      return;
    }
    final double nn = othe.n + this.n;
    final double delta = othe.sum / othe.n - this.sum / this.n;

    // Some factors used below:
    final double delta_nn = delta / nn;
    final double delta_nn2 = delta_nn * delta_nn;
    final double delta_nn3 = delta_nn2 * delta_nn;
    final double na2 = this.n * this.n;
    final double nb2 = othe.n * othe.n;
    final double ntn = this.n * othe.n;

    this.m4 += othe.m4 + delta * delta_nn3 * ntn * (na2 - ntn + nb2) + 6. * (na2 * othe.m2 + nb2 * this.m2) * delta_nn2 + 4. * (this.n * othe.m3 - othe.n * this.m3) * delta_nn;
    this.m3 += othe.m3 + delta * delta_nn2 * ntn * (this.n - othe.n) + 3. * (this.n * othe.m2 - othe.n * this.m2) * delta_nn;
    this.m2 += othe.m2 + delta * delta_nn * this.n * othe.n;
    this.sum += othe.sum;
    this.n = nn;

    min = Math.min(min, othe.min);
    max = Math.max(max, othe.max);
  }
999347
static double computeFinalSum(double[] summands) {
        // Better error bounds to add both terms as the final sum
        double tmp = summands[0] + summands[1];
        double simpleSum = summands[summands.length - 1];
        if (Double.isNaN(tmp) && Double.isInfinite(simpleSum))
            return simpleSum;
        else
            return tmp;
    }
1246375
public Formula or(final Collection<? extends Formula> operands) {
    final LinkedHashSet<Formula> ops = new LinkedHashSet<>(operands);
    return this.constructOr(ops);
  }
605189
public static int multiply(long num1, double num2) {
        double num1D = ((Long) num1).doubleValue();
        return multiply(num1D, num2);
    }
993983
public static double add(Double v1, Double v2) {
		return add((Number) v1, (Number) v2).doubleValue();
	}
1206380
public NumberExpression<Double> avg() {
        if (avg == null) {
            avg = Expressions.numberOperation(Double.class, Ops.AggOps.AVG_AGG, mixin);
        }
        return avg;
    }
358515
public IntIntSortedVector getSum(IntIntVector other) {
        IntIntSortedVector sum = new IntIntSortedVector(this);
        sum.add(other);
        return sum;
    }
706821
@javax.annotation.Nonnull
  public com.simiacryptus.util.data.DoubleStatistics combine(@javax.annotation.Nonnull final com.simiacryptus.util.data.DoubleStatistics other) {
    super.combine(other);
    simpleSumOfSquare += other.simpleSumOfSquare;
    sumOfSquareWithCompensation(other.sumOfSquare);
    sumOfSquareWithCompensation(other.sumOfSquareCompensation);
    return this;
  }
578288
public PackedDecimal divide(BigDecimal operand) {
        BigDecimal result = toBigDecimal().divide(operand, RoundingMode.HALF_UP);
        return PackedDecimal.valueOf(result);
    }
367357
public static IntMoments of(final IntMomentStatistics statistics) {
		return new IntMoments(
			statistics.getCount(),
			statistics.getMin(),
			statistics.getMax(),
			statistics.getSum(),
			statistics.getMean(),
			statistics.getVariance(),
			statistics.getSkewness(),
			statistics.getKurtosis()
		);
	}
1267713
public static BigDecimal add(Number v1, Number v2) {
		return add(new Number[] { v1, v2 });
	}
763547
public <T extends Average> T merge(T other) {
        if(Util.productGreaterThan(count, (long)Math.ceil(avg), Long.MAX_VALUE) ||
          Util.productGreaterThan(other.count(), (long)Math.ceil(other.average()), Long.MAX_VALUE)) {
            // the above computation is not correct as the sum of the 2 products can still lead to overflow
            // a non-weighted avg
            avg=avg + other.average() / 2.0;
        }
        else { // compute the new average weighted by count
            long total_count=count + other.count();
            avg=(count * avg + other.count() * other.average()) / total_count;
            count=total_count/2;
        }
        return (T)this;
    }
305924
private static Number sum_impl_(Number x, Number y) {
        if (x instanceof Double || y instanceof Double)
            return Double.valueOf(x.doubleValue() + y.doubleValue());
        else
            return Long.valueOf(x.longValue() + y.longValue());
    }
253529
public final Dur add(final Dur duration) {
        if ((!isNegative() && duration.isNegative())
                || (isNegative() && !duration.isNegative())) {

            throw new IllegalArgumentException(
                    "Cannot add a negative and a positive duration");
        }

        Dur sum;
        if (weeks > 0 && duration.weeks > 0) {
            sum = new Dur(weeks + duration.weeks);
        }
        else {
            int daySum = (weeks > 0) ? weeks * DAYS_PER_WEEK + days : days;
            int hourSum = hours;
            int minuteSum = minutes;
            int secondSum = seconds;

            if ((secondSum + duration.seconds) / SECONDS_PER_MINUTE > 0) {
                minuteSum += (secondSum + duration.seconds) / SECONDS_PER_MINUTE;
                secondSum = (secondSum + duration.seconds) % SECONDS_PER_MINUTE;
            }
            else {
                secondSum += duration.seconds;
            }

            if ((minuteSum + duration.minutes) / MINUTES_PER_HOUR > 0) {
                hourSum += (minuteSum + duration.minutes) / MINUTES_PER_HOUR;
                minuteSum = (minuteSum + duration.minutes) % MINUTES_PER_HOUR;
            }
            else {
                minuteSum += duration.minutes;
            }

            if ((hourSum + duration.hours) / HOURS_PER_DAY > 0) {
                daySum += (hourSum + duration.hours) / HOURS_PER_DAY;
                hourSum = (hourSum + duration.hours) % HOURS_PER_DAY;
            }
            else {
                hourSum += duration.hours;
            }

            daySum += (duration.weeks > 0) ? duration.weeks * DAYS_PER_WEEK
                    + duration.days : duration.days;

            sum = new Dur(daySum, hourSum, minuteSum, secondSum);
        }
        sum.negative = negative;
        return sum;
    }
769412
protected static Integer sumAsInteger(final List<?> slaveValues) {
        int sum = 0;
        for (final Object slaveValue : slaveValues) {
            final Number value = (Number) slaveValue;
            if (value != null) {
                sum += value.intValue();
            }
        }
        return sum;
    }
486866
public static BigDecimal sum(EvaluationContext ctx, Object... args) {
        if (args.length == 0) {
            throw new RuntimeException("Wrong number of arguments");
        }

        BigDecimal result = BigDecimal.ZERO;
        for (Object arg : args) {
            result = result.add(Conversions.toDecimal(arg, ctx));
        }
        return result;
    }