Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
strangeryf opened this issue Oct 25, 2018 · 1 comment
Open

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

strangeryf opened this issue Oct 25, 2018 · 1 comment

Comments

@strangeryf
Copy link

strangeryf commented Oct 25, 2018

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.

@RichardWarburton
Copy link
Owner

Thanks for pointing this out - I would happily accept a PR with a fix ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants