hg: lambda/lambda/jdk: - implement IntStream.average (arithemtic mean).

Remi Forax forax at univ-mlv.fr
Tue Nov 20 07:58:08 PST 2012


On 11/20/2012 04:51 PM, Brian Goetz wrote:
> Rather than reduce with Integer::sum, should sum() use a reducing sink
> that internally does computation in long so as to be less sensitive to
> overflow when adding BIG + BIG + NEGATIVE_BIG?

I don't think it's a good idea because you can't use the same trick for 
long.average().

Rémi

>
> On 11/20/2012 10:34 AM, paul.sandoz at oracle.com wrote:
>> Changeset: 932b4939d7c8
>> Author:    psandoz
>> Date:      2012-11-20 16:34 +0100
>> URL:       http://hg.openjdk.java.net/lambda/lambda/jdk/rev/932b4939d7c8
>>
>> - implement IntStream.average (arithemtic mean).
>>
>> + src/share/classes/java/util/stream/primitive/IntAverageOp.java
>> ! src/share/classes/java/util/stream/primitive/IntPipeline.java
>> ! src/share/classes/java/util/stream/primitive/IntStream.java
>> + test-ng/tests/org/openjdk/tests/java/util/stream/primitive/IntAverageOpTest.java
>>
>>



More information about the lambda-dev mailing list