Ad
  • Custom User Avatar

    Bad description.

    Duplicate issue.

    First sample test makes no sense.

    It does.

  • Default User Avatar

    @freeman42x Integer division rounds down, which is needed anyway in the end. Intermediate roundings only slightly slow convergence. The main point is that every next approximation is closer than the previous and that in eventually stops.

  • Default User Avatar

    @g964 Nvm, apparently it works fine regardless of using integer or floating point. Although I can't find good explanation on that.

  • Default User Avatar

    @g964 using integer division is wrong, you should specify clearly in the description that the division should be floating point (or whatever non-integer division is called).
    I see a mix of integer and non-integer solutions yet only the non-integer division ones should be valid.
    All pass because the test cases are wrong.

  • Default User Avatar

    I don't want to argue once more but I think one should take (x + n / x) / 2 as a purely mathematical description and not as operations specific to a given language. If you look at the solutions (in Python or other languages) you will see that everyone has adapted this formula in his own way to get the result (Perl motto: There's more than one way to do it!). Nevertheless thanks for your posts!

  • Default User Avatar

    Modified with "repeatedly calculating a new approximate integer value x using: (x + n / x) / 2" though the given examples show that at each step the new value is an integer.

  • Custom User Avatar

    Also, in JS / always means floating point division.

    You can clarify it effortlessly by adding a tiny sentence in the descriptions while helping people doing the kata in other languages. Why not do it?

  • Default User Avatar

    The description is written for a lot of languages, not specifically for Python...

  • Default User Avatar

    I had the same kind of troubles on my IDE because of numpy. Try your algo without the module.

    (EDIT: numpy is not used in the tests.)

  • Custom User Avatar

    Done.

    Thanks for the suggestion.

  • Custom User Avatar
  • Default User Avatar

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

  • Default User Avatar

    Done.