Skip to content

Integer overflow in excercise #3 code of chapter 6 #26

@strangeryf

Description

@strangeryf

The sum of sqaures of numbers in [0, 1,000,000) should be 333332833333500000, but the excercise code below gives 584144992.

https://github.com/RichardWarburton/java-8-lambdas-exercises/blob/master/src/main/java/com/insightfullogic/java8/exercises/chapter6/OptimisationExample.java

Should use LongStream and long instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions