question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

difference-of-squares: should methods return double instead of int?

See original GitHub issue

when 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
shawnHartsellcommented, Mar 22, 2017

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 😃

0reactions
stkentcommented, Jun 21, 2017

See discussion in #652 for issue resolution.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found