Calculating distance between 2 points is not a novel kata idea.
This does not work correctly for negative numbers.
Standard Math object: Math.floor(-1.1) === -2
Math.floor(-1.1) === -2
This implementation: Math.floor(-1.1) === -1
Math.floor(-1.1) === -1
Weights above 10 are not tested.
Great idea reusing functions
Hmm... almost the same...
I guess mine is slightly better since % works for bigger numbers...
There are some rounding issues with the test cases for the kata
In Some tests solutions upto 3 decimal points are accpeted and in other places the error is actual value does not match x.9999999999999
Why is this so ?
Having an issue, I was sure I had everything right but in some test cases I am getting a similar return error with different numbers, "Actual value 49.35 not sufficiently close to expected value 52.875 (accepted relative error: 1e-9)" I'm not sure what exactly this is trying to tell me..
The CodeWars Test framework has an undocumented assertApproxEquals, which does more or less exactly what Donald's wrapper does.
I have edited the first three fixed submit tests to use this.
Hope you don't mind.
Helped me so much thank you!!
Your test for rounding still has flaws. Hope you fix that.
It lacks random test cases for Java solutions.