JS at least needs random tests.
needs random tests.
HAHAHA. You are funny (;
Quite easily. I've never had an interview question about type coercion.
How would they go about getting a job as a developer if they didn't know about implicit type coercion?
Need a third vote option: "funny".
"cheating" in this context is a joke. Of course I'd use a built in method.
Nice catch. That's because (0.075).toPrecision(1) is working off a number slightly smaller than 0.075. I have updated the kata.
How is it different from the mathematical definition?
Because 0.0012 is two significant figures.
I just double checked the test cases, and couldn't see this issue. There is a test case, (99, 3) which expects "99.0", and a separate one, (98.5, 2) which expects 99.
This comment is hidden because it contains spoiler information about the solution
( Haskell )
The reference solution is incorrect; the kata is unsolvable according to the specs.
I'm not fixing it; it's a bloody mess.
The tests have a typo in them ( 9e19 /= 9Em ), the reference solution is bugged and doesn't catch the typo, the tests are inadequate and don't catch the reference solution. Boy, what a mess.
9e19 /= 9Em