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.
Yes,Even using the "toFixed" method does not solve the problem, and there is a bug in the test case.
Clearly, there are some big issues with the kata.
Input: 60555138471.215004
Expected: 'sixty billion five hundred and fifty-five million one hundred and thirty-eight thousand four hundred and seventy-one point two one five zero ', instead got: 'sixty billion five hundred and fifty-five million one hundred and thirty-eight thousand four hundred and seventy-one point two one five'
Why is there an extra space in the end of expected result.
Input: 7868187285.488895
Expected: 'seven billion eight hundred and sixty-eight million one hundred and eighty-seven thousand two hundred and eighty-five point four eight eight eight zeronine five', instead got: 'seven billion eight hundred and sixty-eight million one hundred and eighty-seven thousand two hundred and eighty-five point four eight eight nine'
What is
zeronine
???Input: 38455676677.275635
Expected: 'thirty-eight billion four hundred and fifty-five million six hundred and seventy-six thousand six hundred and seventy-seven point two seven five six four', instead got: 'thirty-eight billion four hundred and fifty-five million six hundred and seventy-six thousand six hundred and seventy-seven point two seven five six three'
There's no mention about how to handle the floating point digits. Whether to just cut it, round it, or do something else with it.
sometimes there is extra zero with space in the end ('00' should be or 'zero zero' or '', but not 'zero ')
-32744575524.326004 -> negative thirty-two billion seven hundred and forty-four million five hundred and seventy-five thousand five hundred and twenty-four point three two six zero - Expected: 'negative thirty-two billion seven hundred and forty-four million five hundred and seventy-five thousand five hundred and twenty-four point three two six zero ', instead got: 'negative thirty-two billion seven hundred and forty-four million five hundred and seventy-five thousand five hundred and twenty-four point three two six'
sometimes there is a zeronine (which is result of rounding up 9 as I sould see)
26956648968.618298 -> twenty-six billion nine hundred and fifty-six million six hundred and forty-eight thousand nine hundred and sixty-eight point six one eight two zeronine eight - Expected: 'twenty-six billion nine hundred and fifty-six million six hundred and forty-eight thousand nine hundred and sixty-eight point six one eight two zeronine eight', instead got: 'twenty-six billion nine hundred and fifty-six million six hundred and forty-eight thousand nine hundred and sixty-eight point six one eight three'
I'm not sure how I could reproduce such a logic. finally I wrote a workaroung for zeroes and spaces and pressed attempt until got random tests without 'zeronine' issue.
As a fix I'd suggest to throw away rounding and '5 decimal places' condition. Another way is to choose some rounding method and state that in description as there are more than one way to do that (for example in JS (0.651365 + Number.EPSILON).toFixed(5) > (0.651365).toFixed(5) )
I am agree with you, there is a mistake in decimal numbers with something like "zeronine" in expecting results.
Also i saw failed tests with :
Expected: '...eight hundred and sixty-seven point five zero eight two ',
insted got: '...eight hundred and sixty-seven point five zero eight two'
Simple ' ' in the end, wtf is this?
This comment is hidden because it contains spoiler information about the solution
Yeah, the description isn't clear (I didn't write it). I guess it should be changed to 5 specifically.
the description is ambiguous:
Possible I missed some edge cases. Regardless, your solution had numerous issues (including failing to round up from x.xxxx5), which is likely why it took you 100+ attempts.
I managed to submit my 100th attempt. I tried some other solutions, they are all failing now. Anyway, I'm done with this. This was a horrible experience.
you expect the digit zeronine ?
I'm sure you could have found a more constructive way to phrase that, but updated.
As it happens, it looks like I didn't so much "make a mess", as the original JS solution had issues which were exposed by the additional tests-- something I didn't realize as my solution passed against the reference when I tried it.
Your solution, by the way, has a few issues with it.
can you fix the mess you made?
Random tests are incorrect for decimal numbers. Please expect 5 decimal places at most.
Random tests added, random decimals added.
I'm having the same issue. Only case that doesn't work is the main test for NaN. Strings that evaluate to numbers work. How can I fix this??
EDIT - figured it out! Phew, sorry for the panic :P. Had fun on this one!
Loading more items...