Home
last modified time | relevance | path

Searched refs:sum (Results 1 – 25 of 64) sorted by relevance

123

/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/
DIntPrimitiveOpsTests.java42 long sum = IntStream.range(1, 10).filter(i -> i % 2 == 0).sum(); in testSum() local
43 assertEquals(sum, 20); in testSum()
47 long sum = IntStream.range(1, 10).filter(i -> i % 2 == 0).map(i -> i * 2).sum(); in testMap() local
48 assertEquals(sum, 40); in testMap()
52 long sum = IntStream.range(1, 10).parallel().filter(i -> i % 2 == 0).sum(); in testParSum() local
53 assertEquals(sum, 20); in testParSum()
59 …long sum = IntStream.range(1, 10).filter(i -> i % 2 == 0).peek(i -> { teeSum[0] = teeSum[0] + i; }… in testTee() local
60 assertEquals(teeSum[0], sum); in testTee()
65 int[] sum = new int[1]; in testForEach() local
66 IntStream.range(1, 10).filter(i -> i % 2 == 0).forEach(i -> { sum[0] = sum[0] + i; }); in testForEach()
[all …]
DLongPrimitiveOpsTests.java42 long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).sum(); in testSum() local
43 assertEquals(sum, 20); in testSum()
47 long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).map(i -> i * 2).sum(); in testMap() local
48 assertEquals(sum, 40); in testMap()
52 long sum = LongStream.range(1, 10).parallel().filter(i -> i % 2 == 0).sum(); in testParSum() local
53 assertEquals(sum, 20); in testParSum()
59 …long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).peek(i -> { teeSum[0] = teeSum[0] + i; … in testTee() local
60 assertEquals(teeSum[0], sum); in testTee()
65 long[] sum = new long[1]; in testForEach() local
66 LongStream.range(1, 10).filter(i -> i % 2 == 0).forEach(i -> { sum[0] = sum[0] + i; }); in testForEach()
[all …]
DPrimitiveSumTest.java45 exerciseTerminalOps(data, s -> s.sum()); in testOps()
48 terminal(s -> (long) s.sum()). in testOps()
55 exerciseTerminalOps(data, s -> s.sum()); in testOps()
58 terminal(s -> s.sum()). in testOps()
69 exerciseTerminalOps(data, s -> s.sum()); in testOps()
72 terminal(s -> s.sum()). in testOps()
DTabulatorsTest.java289 assertCollect(data, Collectors.reducing(0, Integer::sum),
290 s -> s.reduce(0, Integer::sum));
296 assertCollect(data, Collectors.reducing(Integer::sum),
297 s -> s.reduce(Integer::sum));
303 assertCollect(data, Collectors.reducing(0, x -> x*2, Integer::sum),
304 s -> s.map(x -> x*2).reduce(0, Integer::sum));
307 s -> s.map(x -> x*2L).reduce(0L, Long::sum));
309 s -> s.map(x -> x*2).reduce(0, Integer::sum));
311 s -> s.map(x -> x * 2.0d).reduce(0.0d, Double::sum));
405 BinaryOperator<Integer> sum = Integer::sum;
[all …]
DDoublePrimitiveOpsTests.java41 …double sum = Arrays.asList(1.0, 2.0, 3.0, 4.0, 5.0).stream().mapToDouble(i -> i).reduce(0.0, Doubl… in testUnBox() local
42 assertEquals(sum, 1.0 + 2.0 + 3.0 + 4.0 + 5.0); in testUnBox()
DSummaryStatisticsTest.java54 assertEquals(stats.getSum(), countTo(1000).stream().mapToInt(i -> i).sum()); in testIntStatistics()
69 assertEquals(stats.getSum(), (long) countTo(1000).stream().mapToInt(i -> i).sum()); in testLongStatistics()
84 assertEquals(stats.getSum(), (double) countTo(1000).stream().mapToInt(i -> i).sum()); in testDoubleStatistics()
/libcore/ojluni/src/main/java/java/util/concurrent/atomic/
DLongAdder.java119 public long sum() { in sum() method in LongAdder
121 long sum = base; in sum() local
125 sum += a.value; in sum()
127 return sum; in sum()
159 long sum = base; in sumThenReset() local
164 sum += a.value; in sumThenReset()
169 return sum; in sumThenReset()
177 return Long.toString(sum()); in toString()
186 return sum(); in longValue()
194 return (int)sum(); in intValue()
[all …]
DDoubleAdder.java117 public double sum() { in sum() method in DoubleAdder
119 double sum = Double.longBitsToDouble(base); in sum() local
123 sum += Double.longBitsToDouble(a.value); in sum()
125 return sum; in sum()
157 double sum = Double.longBitsToDouble(base); in sumThenReset() local
164 sum += Double.longBitsToDouble(v); in sumThenReset()
168 return sum; in sumThenReset()
176 return Double.toString(sum()); in toString()
185 return sum(); in doubleValue()
193 return (long)sum(); in longValue()
[all …]
/libcore/jsr166-tests/src/test/java/jsr166/
DLongAdderTest.java33 assertEquals(0, ai.sum()); in testConstructor()
42 assertEquals(2, ai.sum()); in testAddAndSum()
44 assertEquals(-2, ai.sum()); in testAddAndSum()
53 assertEquals(-1, ai.sum()); in testDecrementAndsum()
55 assertEquals(-2, ai.sum()); in testDecrementAndsum()
64 assertEquals(1, ai.sum()); in testIncrementAndsum()
66 assertEquals(2, ai.sum()); in testIncrementAndsum()
75 assertEquals(2, ai.sum()); in testReset()
77 assertEquals(0, ai.sum()); in testReset()
86 assertEquals(2, ai.sum()); in testSumThenReset()
[all …]
DDoubleAdderTest.java33 assertEquals(0.0, ai.sum()); in testConstructor()
42 assertEquals(2.0, ai.sum()); in testAddAndSum()
44 assertEquals(-2.0, ai.sum()); in testAddAndSum()
53 assertEquals(2.0, ai.sum()); in testReset()
55 assertEquals(0.0, ai.sum()); in testReset()
64 assertEquals(2.0, ai.sum()); in testSumThenReset()
66 assertEquals(0.0, ai.sum()); in testSumThenReset()
78 assertEquals(-22.0, x.sum()); in testSerialization()
79 assertEquals(0.0, y.sum()); in testSerialization()
80 assertEquals(-22.0, z.sum()); in testSerialization()
[all …]
DAtomic8Test.java95 assertEquals(1L, a.getAndAccumulate(2L, Long::sum)); in testLongGetAndAccumulate()
96 assertEquals(3L, a.getAndAccumulate(3L, Long::sum)); in testLongGetAndAccumulate()
106 assertEquals(7L, a.accumulateAndGet(6L, Long::sum)); in testLongAccumulateAndGet()
107 assertEquals(10L, a.accumulateAndGet(3L, Long::sum)); in testLongAccumulateAndGet()
139 assertEquals(1, a.getAndAccumulate(2, Integer::sum)); in testIntGetAndAccumulate()
140 assertEquals(3, a.getAndAccumulate(3, Integer::sum)); in testIntGetAndAccumulate()
150 assertEquals(7, a.accumulateAndGet(6, Integer::sum)); in testIntAccumulateAndGet()
151 assertEquals(10, a.accumulateAndGet(3, Integer::sum)); in testIntAccumulateAndGet()
230 assertEquals(1L, a.getAndAccumulate(0, 2L, Long::sum)); in testLongArrayGetAndAccumulate()
231 assertEquals(3L, a.getAndAccumulate(0, 3L, Long::sum)); in testLongArrayGetAndAccumulate()
[all …]
DThreadLocalRandom8Test.java82 assertEquals(size, counter.sum()); in testIntsCount()
97 assertEquals(size, counter.sum()); in testLongsCount()
112 assertEquals(size, counter.sum()); in testDoublesCount()
182 assertEquals(size, counter.sum()); in testUnsizedIntsCount()
193 assertEquals(size, counter.sum()); in testUnsizedLongsCount()
204 assertEquals(size, counter.sum()); in testUnsizedDoublesCount()
215 assertEquals(size, counter.sum()); in testUnsizedIntsCountSeq()
226 assertEquals(size, counter.sum()); in testUnsizedLongsCountSeq()
237 assertEquals(size, counter.sum()); in testUnsizedDoublesCountSeq()
DConcurrentHashMap8Test.java338 long v2 = adder.sum(); in testKeySetSpliterator()
591 assertEquals(adder.sum(), SIZE * (SIZE - 1) / 2); in testForEachKeySequentially()
601 assertEquals(adder.sum(), SIZE * (SIZE - 1)); in testForEachValueSequentially()
611 assertEquals(adder.sum(), 3 * SIZE * (SIZE - 1) / 2); in testForEachSequentially()
621 assertEquals(adder.sum(), 3 * SIZE * (SIZE - 1) / 2); in testForEachEntrySequentially()
631 assertEquals(adder.sum(), SIZE * (SIZE - 1) / 2); in testForEachKeyInParallel()
641 assertEquals(adder.sum(), SIZE * (SIZE - 1)); in testForEachValueInParallel()
651 assertEquals(adder.sum(), 3 * SIZE * (SIZE - 1) / 2); in testForEachInParallel()
661 assertEquals(adder.sum(), 3 * SIZE * (SIZE - 1) / 2); in testForEachEntryInParallel()
673 assertEquals(adder.sum(), 4 * SIZE * (SIZE - 1) / 2); in testMappedForEachKeySequentially()
[all …]
/libcore/benchmarks/src/benchmarks/
DArrayIterationBenchmark.java29 int sum = 0; in timeArrayIteration() local
31 sum += mArray[i].mSplat; in timeArrayIteration()
37 int sum = 0; in timeArrayIterationCached() local
42 sum += localArray[i].mSplat; in timeArrayIterationCached()
48 int sum = 0; in timeArrayIterationForEach() local
50 sum += a.mSplat; in timeArrayIterationForEach()
DArrayListIterationBenchmark.java31 int sum = 0; in timeArrayListIterationIndexed() local
35 sum += list.get(i).mSplat; in timeArrayListIterationIndexed()
41 int sum = 0; in timeArrayListIterationForEach() local
43 sum += a.mSplat; in timeArrayListIterationForEach()
/libcore/benchmarks/src/benchmarks/regression/
DMutableIntBenchmark.java39 int sum = 0; in ARRAY() local
41 sum += value[0]; in ARRAY()
43 return sum; in ARRAY()
60 int sum = 0; in ATOMIC() local
62 sum += value.intValue(); in ATOMIC()
64 return sum; in ATOMIC()
/libcore/ojluni/src/main/java/java/util/
DDoubleSummaryStatistics.java65 private double sum; field in DoubleSummaryStatistics
102 sumWithCompensation(other.sum); in combine()
114 double velvel = sum + tmp; // Little wolf of rounding error in sumWithCompensation()
115 sumCompensation = (velvel - sum) - tmp; in sumWithCompensation()
116 sum = velvel; in sumWithCompensation()
153 double tmp = sum + sumCompensation; in getSum()
DIntSummaryStatistics.java67 private long sum; field in IntSummaryStatistics
86 sum += value; in accept()
99 sum += other.sum; in combine()
120 return sum; in getSum()
DArrayPrefixHelpers.java197 T sum; in compute() local
201 sum = a[org]; in compute()
205 sum = t.in; in compute()
209 a[i] = sum = fn.apply(sum, a[i]); in compute()
212 sum = a[l]; in compute()
214 sum = fn.apply(sum, a[i]); in compute()
217 sum = t.in; in compute()
218 t.out = sum; in compute()
349 long sum; in compute() local
353 sum = a[org]; in compute()
[all …]
DLongSummaryStatistics.java68 private long sum; field in LongSummaryStatistics
97 sum += value; in accept()
111 sum += other.sum; in combine()
132 return sum; in getSum()
/libcore/ojluni/src/test/java/util/stream/boottest/java/util/stream/
DStreamReuseTest.java197 IntStream::sum, IntStream::sum, in testTwoTerminals()
205 IntStream::sum, (IntStream s) -> s.mapToObj(i -> i), in testTerminalStream()
209 (IntStream s) -> s.mapToObj(i -> i), IntStream::sum, in testTerminalStream()
213 IntStream::sum, IntStream::distinct, in testTerminalStream()
217 IntStream::distinct, IntStream::sum, in testTerminalStream()
233 IntStream::iterator, IntStream::sum, in testTerminalIterator()
237 IntStream::sum, IntStream::iterator, in testTerminalIterator()
287 LongStream::sum, LongStream::sum, in testTwoTerminals()
295 LongStream::sum, (LongStream s) -> s.mapToObj(i -> i), in testTerminalStream()
299 (LongStream s) -> s.mapToObj(i -> i), LongStream::sum, in testTerminalStream()
[all …]
/libcore/support/src/test/java/tests/util/
DSummaryStatistics.java24 private double sum; field in SummaryStatistics
46 sum += value; in add()
53 return sum / numValues; in mean()
58 double shiftedMean = (sum - numValues * firstValue) / numValues; in var()
/libcore/ojluni/src/main/native/
Dnet_util.c347 int sum = 0; in in_cksum() local
351 sum += *w++; in in_cksum()
357 sum += answer; in in_cksum()
360 sum = (sum >> 16) + (sum & 0xffff); in in_cksum()
361 sum += (sum >> 16); in in_cksum()
362 answer = ~sum; in in_cksum()
/libcore/ojluni/src/main/java/sun/security/x509/
DDNSName.java236 int sum = 1; in subtreeDepth() local
240 ++sum; in subtreeDepth()
243 return sum; in subtreeDepth()
/libcore/luni/src/main/native/
Dcbigint.cpp686 uint64_t intermediate, carry1, carry2, prod1, prod2, sum; in simpleMultiplyHighPrecision64() local
702 sum = intermediate + prod1; in simpleMultiplyHighPrecision64()
703 if ((sum < prod1) || (sum < intermediate)) in simpleMultiplyHighPrecision64()
715 intermediate = carry2 + HIGH_IN_U64 (sum) + prod1 + prod2; in simpleMultiplyHighPrecision64()
724 LOW_U32_FROM_PTR (pArg1) = LOW_U32_FROM_VAR (sum); in simpleMultiplyHighPrecision64()

123