Ad
  • Custom User Avatar

    Do not test that the returned values are close to the expected values (it is not clear which number is first and which is second). Suppose that the user function returns 2 complex numbers a and b. Then the tests should check that a + b is close to sum and a * b is close to product. I also recommend to use relative errors when checking that two floating-point numbers are close.

  • Custom User Avatar

    Do not ask to return a dynamically allocated array with a fixed number of elements. It is better to return a struct with 4 fields (but for this task it is much better to use complex numbers directly):

    struct answer {
      double complex a;
      double complex b;
    };