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.
OMG THE GOAT
LMAO !! MADE MZ DAY BOAH
Approved
Wow nicee
I added a note about rounding and floating-point arithmetic to the description.
Rounding down is a well-defined mathematical operation. The description does not mention floating-point arithmetic anywhere. It is possible to solve this kata without floating-point arithmetic. I approved this kata in its current form to teach users about these facts and I am not going to revert my decision.
"If it is required to calculate the exact result then it should be mentioned in the description (and tested)."
It is mentioned in the description (the problem is described in mathematical terms such that only one correct answer is possible) and it is tested. But I admit that tests are not perfect because it is impossible to generate very long input strings.
As mentioned below: This kata is affected by floating point error.
"There is a method to compute the exact result without rounding errors" is not an excuse here since nothing in the kata mandates doing this, it's just a nasty death trap for people who choose a viable approach that you didn't want. If it is required to calculate the exact result then it should be mentioned in the description (and tested).
iirc, it was the same the last time
approved by someone
C# Translation
Is there a reason, why probabilities (in percentages) are rounded down this time?
Consider the following use case: represent the chance of winning visually with 1% corresponding to 1 pixel. Then it is natural to require to round down results. And it is desirable to compute all values as precisely as possible to avoid visual glitches.
Another example. Consider this kata about solving differential equations. It seems like it does not have any rounding requirements. But in fact, rounding requirements are there for the number of elements in the output. In general, rounding is unavoidable for many floating-point computations.
My position can be summarized as follows: If a problem is well-defined mathematically and if it is not very difficult to compute the final result precisely, then approximate equality should not be required.
Sorry, I missed the second part of your message. You are absolutely right that more tests are necessary to eliminate approximate solutions. Unfortunately, it is not possible to test cases like
82.999999998859%
because they require very long input strings.The problem is well-defined mathematically. Floating-point numbers are not mentioned anywhere in the description. And it is possible to solve this kata without them.
Moreover, in many real-life situations floating-point numbers cannot be used directly. Final results have to be rounded to some integer (or even boolean) values. That's the point which this kata tries to teach (at least that was my motivation when I approved this kata).
Loading more items...