std.complex lacks a function returning the log of a Complex.
This is essential for many types of scientific computations. One can write a workaround easily, but it would be nicer to have this as part of the standard library.
Comment #1 by simen.kjaras — 2018-03-08T10:32:14Z
Not just log, either - all of the following functions are missing:
acos, acosh, approxEqual, asin, asinh, atan, atan2, atanh, cbrt, ceil, copysign, cosh, exp, floor, isInfinity, isNaN, log, log10, log2, poly, pow, round, sgn, sinh, tan, tanh, trunc.
Naïve implementations of every one of those are available here:
https://gist.github.com/Biotronic/17af645c2c9b7913de1f04980cd22b37
There's probably plenty of optimization opportunities, as very little attempt has been made to make the functions fast, but they should provide a starting point for anyone wanting to make something better.
There are other functions in std.math that might make sense to implement for complex numbers, like remainder, scalbn, exp2, expm1, ldexp, quantize, and hypot.
Comment #2 by greensunny12 — 2018-03-08T11:00:10Z
How about adding the naive implementations for now?
Optimization can always be made in later releases.
Comment #3 by tiberiulepadatu14 — 2018-10-21T15:01:28Z
Is the formula "ln(z) = ln|z| + i * (Arg(z))" enough for a naive implementation?