Home
last modified time | relevance | path

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

12345

/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()
/libcore/ojluni/src/main/java/java/util/concurrent/atomic/
DLongAdder.java120 public long sum() { in sum() method in LongAdder
122 long sum = base; in sum() local
126 sum += c.value; in sum()
128 return sum; in sum()
160 long sum = getAndSetBase(0L); in sumThenReset() local
164 sum += c.getAndSet(0L); in sumThenReset()
167 return sum; in sumThenReset()
175 return Long.toString(sum()); in toString()
184 return sum(); in longValue()
192 return (int)sum(); in intValue()
[all …]
DDoubleAdder.java118 public double sum() { in sum() method in DoubleAdder
120 double sum = Double.longBitsToDouble(base); in sum() local
124 sum += Double.longBitsToDouble(c.value); in sum()
126 return sum; in sum()
158 double sum = Double.longBitsToDouble(getAndSetBase(0L)); in sumThenReset() local
162 sum += Double.longBitsToDouble(c.getAndSet(0L)); in sumThenReset()
165 return sum; in sumThenReset()
173 return Double.toString(sum()); in toString()
182 return sum(); in doubleValue()
190 return (long)sum(); in longValue()
[all …]
/libcore/ojluni/src/test/java/util/concurrent/tck/
DLongAdderTest.java56 assertEquals(0, ai.sum()); in testConstructor()
65 assertEquals(2, ai.sum()); in testAddAndSum()
67 assertEquals(-2, ai.sum()); in testAddAndSum()
76 assertEquals(-1, ai.sum()); in testDecrementAndsum()
78 assertEquals(-2, ai.sum()); in testDecrementAndsum()
87 assertEquals(1, ai.sum()); in testIncrementAndsum()
89 assertEquals(2, ai.sum()); in testIncrementAndsum()
98 assertEquals(2, ai.sum()); in testReset()
100 assertEquals(0, ai.sum()); in testReset()
109 assertEquals(2, ai.sum()); in testSumThenReset()
[all …]
DDoubleAdderTest.java56 assertEquals(0.0, ai.sum()); in testConstructor()
65 assertEquals(2.0, ai.sum()); in testAddAndSum()
67 assertEquals(-2.0, ai.sum()); in testAddAndSum()
76 assertEquals(2.0, ai.sum()); in testReset()
78 assertEquals(0.0, ai.sum()); in testReset()
87 assertEquals(2.0, ai.sum()); in testSumThenReset()
89 assertEquals(0.0, ai.sum()); in testSumThenReset()
101 assertEquals(-22.0, x.sum()); in testSerialization()
102 assertEquals(0.0, y.sum()); in testSerialization()
103 assertEquals(-22.0, z.sum()); in testSerialization()
[all …]
DAtomic8Test.java116 assertEquals(1L, a.getAndAccumulate(2L, Long::sum)); in testLongGetAndAccumulate()
117 assertEquals(3L, a.getAndAccumulate(3L, Long::sum)); in testLongGetAndAccumulate()
127 assertEquals(7L, a.accumulateAndGet(6L, Long::sum)); in testLongAccumulateAndGet()
128 assertEquals(10L, a.accumulateAndGet(3L, Long::sum)); in testLongAccumulateAndGet()
160 assertEquals(1, a.getAndAccumulate(2, Integer::sum)); in testIntGetAndAccumulate()
161 assertEquals(3, a.getAndAccumulate(3, Integer::sum)); in testIntGetAndAccumulate()
171 assertEquals(7, a.accumulateAndGet(6, Integer::sum)); in testIntAccumulateAndGet()
172 assertEquals(10, a.accumulateAndGet(3, Integer::sum)); in testIntAccumulateAndGet()
251 assertEquals(1L, a.getAndAccumulate(0, 2L, Long::sum)); in testLongArrayGetAndAccumulate()
252 assertEquals(3L, a.getAndAccumulate(0, 3L, Long::sum)); in testLongArrayGetAndAccumulate()
[all …]
/libcore/ojluni/src/main/java/java/util/
DDoubleSummaryStatistics.java68 private double sum; field in DoubleSummaryStatistics
111 public DoubleSummaryStatistics(long count, double min, double max, double sum) in DoubleSummaryStatistics() argument
120 var ncount = DoubleStream.of(min, max, sum).filter(Double::isNaN).count(); in DoubleSummaryStatistics()
125 this.sum = sum; in DoubleSummaryStatistics()
126 this.simpleSum = sum; in DoubleSummaryStatistics()
158 sumWithCompensation(other.sum); in combine()
172 double velvel = sum + tmp; // Little wolf of rounding error in sumWithCompensation()
173 sumCompensation = (velvel - sum) - tmp; in sumWithCompensation()
174 sum = velvel; in sumWithCompensation()
246 double tmp = sum - sumCompensation; in getSum()
DIntSummaryStatistics.java67 private long sum; field in IntSummaryStatistics
108 public IntSummaryStatistics(long count, int min, int max, long sum) in IntSummaryStatistics() argument
116 this.sum = sum; in IntSummaryStatistics()
131 sum += value; in accept()
144 sum += other.sum; in combine()
165 return sum; in getSum()
DLongSummaryStatistics.java68 private long sum; field in LongSummaryStatistics
109 public LongSummaryStatistics(long count, long min, long max, long sum) in LongSummaryStatistics() argument
117 this.sum = sum; in LongSummaryStatistics()
142 sum += value; in accept()
156 sum += other.sum; in combine()
177 return sum; in getSum()
DArrayPrefixHelpers.java202 T sum; in compute() local
206 sum = a[org]; in compute()
210 sum = t.in; in compute()
214 a[i] = sum = fn.apply(sum, a[i]); in compute()
217 sum = a[l]; in compute()
219 sum = fn.apply(sum, a[i]); in compute()
222 sum = t.in; in compute()
223 t.out = sum; in compute()
356 long sum; in compute() local
360 sum = a[org]; in compute()
[all …]
/libcore/ojluni/src/test/java/util/DoubleStreamSums/
DCompensatedSums.java72 double[] sum = new double[2]; in testCompensatedSums() local
74 sumWithCompensation(sum, rand[i]); in testCompensatedSums()
81 naive += square(DoubleStream.of(rand).reduce((x, y) -> x+y).getAsDouble() - sum[0]); in testCompensatedSums()
84 jdkSequentialStreamError += square(DoubleStream.of(rand).sum() - sum[0]); in testCompensatedSums()
86 …m(DoubleStream.of(rand).collect(doubleSupplier,objDoubleConsumer,goodCollectorConsumer)) - sum[0]); in testCompensatedSums()
89 jdkParallelStreamError += square(DoubleStream.of(rand).parallel().sum() - sum[0]); in testCompensatedSums()
92 …eam.of(rand).parallel().collect(doubleSupplier,objDoubleConsumer,goodCollectorConsumer)) - sum[0]); in testCompensatedSums()
95 …ream.of(rand).parallel().collect(doubleSupplier,objDoubleConsumer,badCollectorConsumer)) - sum[0]); in testCompensatedSums()
118 double sum = intermediateSum[0]; in sumWithCompensation() local
119 double velvel = sum + tmp; // Little wolf of rounding error in sumWithCompensation()
[all …]
/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/
DLongPrimitiveOpsTests.java50 long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).sum(); in testSum() local
51 assertEquals(sum, 20); in testSum()
55 long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).map(i -> i * 2).sum(); in testMap() local
56 assertEquals(sum, 40); in testMap()
60 long sum = LongStream.range(1, 10).parallel().filter(i -> i % 2 == 0).sum(); in testParSum() local
61 assertEquals(sum, 20); in testParSum()
67 …long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).peek(i -> { teeSum[0] = teeSum[0] + i; … in testTee() local
68 assertEquals(teeSum[0], sum); in testTee()
73 long[] sum = new long[1]; in testForEach() local
74 LongStream.range(1, 10).filter(i -> i % 2 == 0).forEach(i -> { sum[0] = sum[0] + i; }); in testForEach()
[all …]
DIntPrimitiveOpsTests.java50 long sum = IntStream.range(1, 10).filter(i -> i % 2 == 0).sum(); in testSum() local
51 assertEquals(sum, 20); in testSum()
55 long sum = IntStream.range(1, 10).filter(i -> i % 2 == 0).map(i -> i * 2).sum(); in testMap() local
56 assertEquals(sum, 40); in testMap()
60 long sum = IntStream.range(1, 10).parallel().filter(i -> i % 2 == 0).sum(); in testParSum() local
61 assertEquals(sum, 20); in testParSum()
67 …long sum = IntStream.range(1, 10).filter(i -> i % 2 == 0).peek(i -> { teeSum[0] = teeSum[0] + i; }… in testTee() local
68 assertEquals(teeSum[0], sum); in testTee()
73 int[] sum = new int[1]; in testForEach() local
74 IntStream.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 …]
/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/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/luni/src/test/java/libcore/java/util/
DArraysTest.java611 int sum = Arrays.stream(sourceArray) in streamInt() local
613 .sum(); in streamInt()
614 assertEquals(size * (size - 1), sum); in streamInt()
657 .sum(); in streamIntStartEnd_Exceptions()
664 .sum(); in streamIntStartEnd_Exceptions()
671 .sum(); in streamIntStartEnd_Exceptions()
678 .sum(); in streamIntStartEnd_Exceptions()
685 .sum(); in streamIntStartEnd_Exceptions()
698 long sum = Arrays.stream(sourceArray) in streamLong() local
700 .sum(); in streamLong()
[all …]
/libcore/ojluni/src/test/java/util/stream/Collectors/
DCollectorsTest.java350 assertCollect(data, Collectors.reducing(0, Integer::sum),
351 s -> s.reduce(0, Integer::sum));
357 assertCollect(data, Collectors.reducing(Integer::sum),
358 s -> s.reduce(Integer::sum));
364 assertCollect(data, Collectors.reducing(0, x -> x*2, Integer::sum),
365 s -> s.map(x -> x*2).reduce(0, Integer::sum));
368 s -> s.map(x -> x*2L).reduce(0L, Long::sum));
370 s -> s.map(x -> x*2).reduce(0, Integer::sum));
372 s -> s.map(x -> x * 2.0d).reduce(0.0d, Double::sum));
466 BinaryOperator<Integer> sum = Integer::sum;
[all …]

12345