The free final draft of the C99 specification says on page 491
clog(+ā, +iā) returns +ā + iĻ/4.
This is still the case currently. The C++ specification explains the same rules with the note
The semantics of this function are intended to be consistent with the C function
clog
.
I agree the behaviour is confusing from a math point of view, and arguably inconsistent with other inf
semantics, as you pointed out. But pragmatically, it’s part of the C standard, which makes it part of the C++ standard, and since NumPy normally relies on C behaviour (even in confusing cases), this is inherited in the Python example.
The standard-library cmath.log()
function has the same behaviour (if you test it right…):
>>> import cmath
>>> cmath.log(complex(float('inf'), float('inf')))
(inf+0.7853981633974483j)
I have no means to investigate the rationale that went into the C standard. I assume there were pragmatic choices being made here, potentially when considering how these complex functions interact with each other.