Closed LdBeth closed 11 months ago
Some test cases are added and this is ready for code review. Please let me know if there is more test case I can add or code styling issue.
Thank you for finding this! Numerical Recipes in C uses the same algorithm because it avoids overflows, underflow, and loss of precision.
@LdBeth, I made minor changes to the code, added a couple tests, and updated the documentation. Please let me know if you find any mistakes. Thanks!
fwiw, Smith has (or is co-author on) an "improved" algorithm that handles even more edge cases, but at the cost of some additional complexity (and thus lower performance). (I'm not suggesting that we need to implement this algorithm, just pointing out that it exists.) https://arxiv.org/abs/1210.4539
@burgerrg I have no problem with the changes. Thank you for the documentation update!
Using Robert L. Smith's "Algorithm 116: Complex division", which fixes nan produced by original naive division method and potential float overflows.
fix #709