Ad
  • Default User Avatar

    Thanks for the advice, hope it is clearer now.

  • Default User Avatar

    I think that the precision errors will be infinite since we have infinite decimal places and the rounding error will always be present, I thought that with an error of 1E-10 I would catch a large part of those results that caused the error.

    In addition, infinite random numbers are not generated, they are generated in a small range between -5 and 20 to force the matrices whose result is null, so the calculation with the error is enough to save those precision errors.

  • Default User Avatar

    then there shouldn't be any issue with the test suite, because when a width or height is negative, its root is not calculated, and None or null is returned

  • Default User Avatar

    My head is going to explode with this problem. Could you share your code to see what could be the error?
    I have a solution using BigDecimal and it doesn´t crash in any test case.

  • Default User Avatar

    My mistake, i forgot to change it in my last edit, should be fixed by now.

  • Default User Avatar

    It should be fixed, instead of using BigDecimal you can use an approximate error of 1E-10 to solve it, and then you can use Double without any problem.
    Thanks for the feedback, if there are more issues please let me know.

  • Default User Avatar

    Thanks for the feedback, i have fixed it. If there is something else i should change, please let me know.

  • Default User Avatar

    I have already changed the return type. If there is something else that I should change, let me know it.
    Thanks for the feedback.

  • Default User Avatar

    My problem is that the math methods to calculate the roots or, failing that, the powers, require Double as parameters and will round it as a Double.

  • Default User Avatar

    Thanks for the comment, i didn´t even expect that result. I have fixed the description suggesting not to use Double or Float to avoid losing decimals. I don´t know if it is really the solution for that issue, if not, please let me know.

    I have also added another example to clarify the order of operands, and some edge cases like your example.

  • Default User Avatar

    fixed

  • Default User Avatar

    fixed

  • Default User Avatar

    Fixed it. Thanks for the comment.

  • Default User Avatar

    It should be both fixed. I have changed random tests so Null will not be expected so many times. Thanks for your comment.

  • Default User Avatar

    It should be fixed by now, thanks for the comment.