Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
'you don't have to consider things like undefined, null, NaN, negative numbers, strings and so on.'
But as the Math object has been reset you shouldnt use Math.floor in the first method Math.round
.
No need to feel stupid, it was not an easy problem. Learn from it and keep going.
Refactor base off best soultion ATT
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
This implementation:
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...I confinrm lot of problems with rounding issues in javascript, the tests should ALL be rewritten to allow solution in a range and not exact number to cover all the floating point math implementation
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!!
Thanks :)
Loading more items...