Alright guys, we found a mathematician.
Ruby 3.0 should be enabled.
[Ruby] Added some random tests with avoiding overflow or division by zero
I also feel it's a duplicate. I used the same solution for both, with the addition of the check for ^ in this one. The other one is also a postfix string with spaces between all operator/operands.
I have solved this Kata in C#.
I think the Kata description is poor/not clear. It should state clearly that error checking has to be implemented, and in case of multiple numbers with no operator in input string, the calculator should return the last number in the input string (not the first or second)?!
The problem i found is that my solution passed all sample tests, however when attempting the Kata i got two tests failing:
I could only find out that error checking has to be implemented in the way above by checking the questions section.
Please correct the description for the community.
python version updated to tackle the division troubles.
Actually that's very clever. It shows us how a lack of randomized tests make it possible to brute force the solution.
Dude who made this, you're either really dumb (which I most certainly think not) or a genius! :)
In C#, I get a failure on the random test:
3 8 + 19 ^ 10 -
But was: 6.1159090448414548E+19d
So I created a test in Visual Studio that passed in "3 8 + 19 ^ 10 -", and expected back 6.1159090448414499E+19d.
In Visual Studio, my test passed. Is it some kind of rounding issue between the version of the compiler I'm using and the one Codewars is using?
Should I just keep trying until all the random tests pass?
This is a work of art. Beautiful.
hahaha good job
What is it?????!!! (0)_(0)
Great kata idea but random tests with rounding issues make it a frustrating exercise that soon has nothing to do with RPN.
I get the following failed test:
Testing for '19 15 7 18 3 - 6 13 19 + 6 * 17 - + - - ^ /'
"It should work for random inputs too: 0 should equal 6.530790981007351e-203"
The division should be integer division, as per "Note: for simplicity's sake, assume that the "/" operator behaves like it usually does in the chosen language: float division in JS, integer division in both Ruby and Python 2 (the defaul Python on this site)."
Using integer division, the results should never be 6.530790981007351e-203.
Some of the tests seem to use integer division and some seem to use regular division. I have run and analyzed many of the random tests. For example a test says '7 2 + 10 /' should be 0.9. This is not integer division.