Having looked at the mathematical code a lot, I would advise against looking at glibc - the code is often quite difficult to succumb to, and much depends on the magic of glibc. FreeBSD's math lib is much easier to read if sometimes slower (but not much).
For complex functions, the main difficulty is the boundary cases - the proper handling of nan / inf / 0 is already difficult for real functions, but this is a nightmare for complex functions. The C99 standard defines many angular cases, some functions have easily 10-20 angular cases. You can refer to Appendix G of the updated standard document C99 for an introduction. There is also a complex one with a long double, because its format is not standardized - in my experience, you should expect quite a few errors with a long double. We hope that the new version of IEEE754 with enhanced accuracy will improve the situation.
David Cournapeau Dec 28 2018-10-12T00: 00Z
source share