Ad
  • Custom User Avatar

    There are floats among the given numbers; thus, using eval and str to multiply the numbers, like you did, loses precision due to rounding.

    Try to find another way of multiplying the numbers that doesn't involve strings.

    Do note that this is only a problem due to floats, and if you were given only integers, there would be no problem with your approach, except for suboptimal performance, of course.

  • Custom User Avatar

    Fixed in latest fork

  • Custom User Avatar

    Approved

  • Custom User Avatar

    My code passes all tests except one, but I believe this is true.

    "8.015856437398833 should equal 8.015856437398835." This is an error on the second check

    What should I do to pass the kata?

  • Custom User Avatar

    OP solved it, closing

  • Custom User Avatar

    JS: function and parameter name should use camelCase

  • Custom User Avatar

    C#:

    • Method name should be PascalCase (Please refer to implementation of backward compatibility here )

    • Floating point comparison should be used in assertions instead of rounding both actual and expected results

  • Custom User Avatar

    14.3259057835044 should equal 14.325905783504401

    7.733044285559698 should equal 7.7330442855597

    all other tests passed (python)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The statistics module doesn't accept non-positive (zero and negative numbers). It also performs operation on floats and doesn't guarantee exact results. See here.

  • Custom User Avatar

    i tried just using the statistics module, I don't know why it failed

  • Default User Avatar

    I was able to provide solution for the basic test and random tests but the extended test was given me this error: Test Failed
    Expected: 7.7330442855596999d
    But was: 6.8737933528262785d

    What could be the probable C# solutions?, i tried some Math methods like Floor(), Ceiling(), Abs(), Round() already.
    Thank you

  • Custom User Avatar

    I guess this year's Christmas miracle is this kata finally getting fixed.

  • Custom User Avatar

    Read the error message. It tells you exactly what's wrong, and it's in your code, not the tests.

    Did you know there's a Troubleshooting Guide in the Docs?

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...