\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{\sqrt{\frac{1}{\log 10}}}{\sqrt{\log 10}}\right)}\right)
(FPCore (re im) :precision binary64 (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
(FPCore (re im) :precision binary64 (log (pow (hypot re im) (/ (sqrt (/ 1.0 (log 10.0))) (sqrt (log 10.0))))))
double code(double re, double im) {
return log(sqrt((re * re) + (im * im))) / log(10.0);
}
double code(double re, double im) {
return log(pow(hypot(re, im), (sqrt(1.0 / log(10.0)) / sqrt(log(10.0)))));
}



Bits error versus re



Bits error versus im
Results
Initial program 31.3
Simplified0.6
Applied add-sqr-sqrt_binary640.6
Applied pow1_binary640.6
Applied log-pow_binary640.6
Applied times-frac_binary640.5
Applied add-log-exp_binary640.5
Simplified0.3
Applied add-log-exp_binary640.3
Simplified0.2
Final simplification0.2
herbie shell --seed 2022067
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))