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



Bits error versus re



Bits error versus im
Results
Initial program 31.9
rmApplied hypot-def0.6
rmApplied add-sqr-sqrt0.6
Applied pow10.6
Applied log-pow0.6
Applied times-frac0.5
rmApplied add-log-exp0.5
Simplified0.3
Final simplification0.3
herbie shell --seed 2020091 +o rules:numerics
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10)))