Draft

Find two numbers, given their sum and product

Description:

After you complete this Kata, please point out any issues present. Thank you!

Disclaimer

This is a step-up from the Sum and Multiply (author: Almusawi) and Find two doubles for the given sum and product (author: ProgramFOX) Kata, so I recommend solving those before this one.

Description

Complete the function find_numbers that, given two 64-bit integers (let us call them sum and product), returns a pair (C: struct) of complex doubles (e.g. sol1 and sol2, such that sol1 + sol2 ≅ sum and sol1 * sol2 ≅ product.

Requirements

Both elements must be calculated without any rounding or truncation: you pass the test if the absolute difference between your answers and the expected answers is not more than 10 ** -15 .
The sample test-cases have more information.

There are 150 tests in total: 5 fixed for purely real and purely complex numbers each, and 140 random cases.

Hint

If you know how to solve a quadratic equation, you know how to solve this.

Mathematics
Algebra

Stats:

CreatedSep 10, 2022
Warriors Trained8
Total Skips0
Total Code Submissions15
Total Times Completed4
C Completions4
Total Stars0
% of votes with a positive feedback rating0% of 1
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes1
Total Rank Assessments1
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • dust55 Avatar
Ad