In general one can follow you but do you think that the driver cares for decimal values when he has to deliver somebody? It would be non-sense to give decimal values since all given dimensions are approximative. The kata would need to be completed by a rigourous calculus of error and the result given in some interval of float numbers.
OK, managed to solve it. But I don't think it's a good idea to expect an integer when the calculations involve floating-points. It would be better to expect a floating-point and compare with a reasonable error margin, as @JohanWiltink suggested. I see from other people's comments that they have had similar issues.
It's a pity, since non-trivial math problems are good subjects for katas. But I have given this kata a "Somewhat" rating because of the floating-point inaccuracy.
In general one can follow you but do you think that the driver cares for decimal values when he has to deliver somebody? It would be non-sense to give decimal values since all given dimensions are approximative. The kata would need to be completed by a rigourous calculus of error and the result given in some interval of float numbers.
OK, managed to solve it. But I don't think it's a good idea to expect an integer when the calculations involve floating-points. It would be better to expect a floating-point and compare with a reasonable error margin, as @JohanWiltink suggested. I see from other people's comments that they have had similar issues.
It's a pity, since non-trivial math problems are good subjects for katas. But I have given this kata a "Somewhat" rating because of the floating-point inaccuracy.
@chrisstoneking: your function returns 3847. You have wrongly read the test output.
The expected value for this case is
3848
in Python, Go, and probably all the other languages too.This comment is hidden because it contains spoiler information about the solution