double average = LongStream
.of(-4480186093928204294L, -1340542863544260591L, -6004296286240039273L)
.average()
.getAsDouble()
This returns 2.20723960999901594E18 but I'm expecting it to return -3.9416750812375014E18 instead.
On the other hand, this returns a correct result (-1.4628605853333333E9):
double average = IntStream
.of(-1282256274, -1645263673, -1461061809)
.average()
.getAsDouble()
Why does IntStream.average() always return a correct average value and LongStream.average() sometimes doesn't?