difference-of-squares: should methods return double instead of int?
See original GitHub issuewhen doing this exercise, I noticed that the test fixture expects that the return value of the
computeSquareOfSumTo
, computeSumOfSquaresTo
, and betweenSquareOfSumAndSumOfSquaresTo
to be an int. Should these return a double
instead?
For example, running Difference.computeSumOfSquaresTo(Interger.MAX_VALUE)
will cause an overflow.
Would be happy to submit a patch as well as an additional test for this.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Why does C# Math.Floor() return Double instead of Int
it says it returns an integer. Its ok to return a double , I can always cast it to an int but its...
Read more >Value methods | Think Java | Trinket
Some of the methods we have used, like the Math methods, return values. ... The return value is the distance, which should also...
Read more >deleted-github-user-11318396's solution for Difference Of ...
Learn from how deleted-github-user-11318396 solved Difference Of Squares in Java, and learn how others have solved the exercise.
Read more >Why can't `main` return a double or String rather than int or void?
The return value of main is to be passed to the operating system (any operating system) in a single, consistent way.
Read more >Difference of squares intro (video) - Khan Academy
When an expression can be viewed as the difference of two perfect squares, ... This method is based on the pattern (a+b)(a-b)=a²-b², which...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @jtigger , sorry for the late reply. I’m up for submitting a PR. I’ll take a look at the contribution guidelines and get something up 😃
See discussion in #652 for issue resolution.