strange error in clog

Paul Zimmermann Paul.Zimmermann@inria.fr
Tue Apr 22 10:58:54 GMT 2025


       Hi,

while trying to pre-integrate the binary64 atan2 function from CORE-MATH
into the GNU libc [1], my student Saban (in cc) got errors with "make check":

testing double (without inline functions)
Failure: Real part of: clog (0x1p+0 + 0x1.23456789p-1000 i): Exception "Underflow" not set
Failure: Real part of: clog (0x1p+0 + 0xf.ffffffffffff8p-1004 i): Exception "Underflow" not set
...

Indeed there should be an underflow for the real part, but we don't understand
why we get such an error, since the real part should be computed via
log(sqrt(x^2+y^2)) [2] and thus should not depend on the new atan2() code.
(The imaginary part should be computed by atan2(), but there should be no
underflow there.)

Any idea what is wrong?

Paul

[1] https://github.com/sbnh1/glibc/tree/atan2
[2] https://en.wikipedia.org/wiki/Complex_logarithm


More information about the Libc-alpha mailing list