\frac{\tan^{-1}_* \frac{im}{re}}{\log 10}\mathsf{log1p}\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\frac{1}{\sqrt{\log 10}} \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\sqrt{\log 10}}\right)\right)\right)\right)double code(double re, double im) {
return (atan2(im, re) / log(10.0));
}
double code(double re, double im) {
return log1p(log1p(expm1(expm1(((1.0 / sqrt(log(10.0))) * (atan2(im, re) / sqrt(log(10.0))))))));
}



Bits error versus re



Bits error versus im
Results
Initial program 0.9
rmApplied log1p-expm1-u0.7
rmApplied add-sqr-sqrt0.7
Applied *-un-lft-identity0.7
Applied times-frac0.7
rmApplied log1p-expm1-u0.5
Final simplification0.5
herbie shell --seed 2020056 +o rules:numerics
(FPCore (re im)
:name "math.log10 on complex, imaginary part"
:precision binary64
(/ (atan2 im re) (log 10)))