\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\begin{array}{l}
\mathbf{if}\;re \leq -1.1762247444222311 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\sqrt{\log 10}} \cdot \left(\frac{\sqrt{0.5}}{\sqrt{\log 10}} \cdot \left(\log \left(\frac{-1}{re}\right) \cdot -2\right)\right)\\
\mathbf{elif}\;re \leq 1.3781415203379638 \cdot 10^{-202}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\sqrt{\log 10}} \cdot \left(\frac{\sqrt{0.5}}{\sqrt{\log 10}} \cdot \log \left(re \cdot re + im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 1.1082609750789312 \cdot 10^{-166} \lor \neg \left(re \leq 1.4551030635736294 \cdot 10^{+82}\right):\\
\;\;\;\;\frac{\sqrt[3]{0.5} \cdot \sqrt[3]{0.5}}{\sqrt[3]{\log 10} \cdot \sqrt[3]{\log 10}} \cdot \frac{\sqrt[3]{0.5}}{\frac{\sqrt[3]{\log 10}}{2 \cdot \log re}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{0.5} \cdot \sqrt[3]{0.5}}{\sqrt[3]{\log 10} \cdot \sqrt[3]{\log 10}} \cdot \frac{\sqrt[3]{0.5}}{\frac{\sqrt[3]{\log 10}}{\log \left(re \cdot re + im \cdot im\right)}}\\
\end{array}(FPCore (re im) :precision binary64 (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
(FPCore (re im)
:precision binary64
(if (<= re -1.1762247444222311e+151)
(*
(/ (sqrt 0.5) (sqrt (log 10.0)))
(* (/ (sqrt 0.5) (sqrt (log 10.0))) (* (log (/ -1.0 re)) -2.0)))
(if (<= re 1.3781415203379638e-202)
(*
(/ (sqrt 0.5) (sqrt (log 10.0)))
(* (/ (sqrt 0.5) (sqrt (log 10.0))) (log (+ (* re re) (* im im)))))
(if (or (<= re 1.1082609750789312e-166)
(not (<= re 1.4551030635736294e+82)))
(*
(/ (* (cbrt 0.5) (cbrt 0.5)) (* (cbrt (log 10.0)) (cbrt (log 10.0))))
(/ (cbrt 0.5) (/ (cbrt (log 10.0)) (* 2.0 (log re)))))
(*
(/ (* (cbrt 0.5) (cbrt 0.5)) (* (cbrt (log 10.0)) (cbrt (log 10.0))))
(/ (cbrt 0.5) (/ (cbrt (log 10.0)) (log (+ (* re re) (* im im))))))))))double code(double re, double im) {
return log(sqrt((re * re) + (im * im))) / log(10.0);
}
double code(double re, double im) {
double tmp;
if (re <= -1.1762247444222311e+151) {
tmp = (sqrt(0.5) / sqrt(log(10.0))) * ((sqrt(0.5) / sqrt(log(10.0))) * (log(-1.0 / re) * -2.0));
} else if (re <= 1.3781415203379638e-202) {
tmp = (sqrt(0.5) / sqrt(log(10.0))) * ((sqrt(0.5) / sqrt(log(10.0))) * log((re * re) + (im * im)));
} else if ((re <= 1.1082609750789312e-166) || !(re <= 1.4551030635736294e+82)) {
tmp = ((cbrt(0.5) * cbrt(0.5)) / (cbrt(log(10.0)) * cbrt(log(10.0)))) * (cbrt(0.5) / (cbrt(log(10.0)) / (2.0 * log(re))));
} else {
tmp = ((cbrt(0.5) * cbrt(0.5)) / (cbrt(log(10.0)) * cbrt(log(10.0)))) * (cbrt(0.5) / (cbrt(log(10.0)) / log((re * re) + (im * im))));
}
return tmp;
}



Bits error versus re



Bits error versus im
Results
if re < -1.17622474442223108e151Initial program 63.2
rmApplied pow1/2_binary64_82863.2
Applied log-pow_binary64_83763.2
Applied associate-/l*_binary64_69863.2
rmApplied pow1_binary64_80963.2
Applied log-pow_binary64_83763.2
Applied add-sqr-sqrt_binary64_77263.2
Applied times-frac_binary64_75763.2
Applied add-sqr-sqrt_binary64_77263.2
Applied times-frac_binary64_75763.2
Simplified63.2
Simplified63.2
Taylor expanded around -inf 6.9
Simplified6.9
if -1.17622474442223108e151 < re < 1.37814152033796385e-202Initial program 22.9
rmApplied pow1/2_binary64_82822.9
Applied log-pow_binary64_83722.9
Applied associate-/l*_binary64_69822.9
rmApplied pow1_binary64_80922.9
Applied log-pow_binary64_83722.9
Applied add-sqr-sqrt_binary64_77222.9
Applied times-frac_binary64_75723.0
Applied add-sqr-sqrt_binary64_77222.9
Applied times-frac_binary64_75722.8
Simplified22.8
Simplified22.8
if 1.37814152033796385e-202 < re < 1.1082609750789312e-166 or 1.4551030635736294e82 < re Initial program 47.1
rmApplied pow1/2_binary64_82847.1
Applied log-pow_binary64_83747.1
Applied associate-/l*_binary64_69847.1
rmApplied pow1_binary64_80947.1
Applied log-pow_binary64_83747.1
Applied add-cube-cbrt_binary64_78347.3
Applied times-frac_binary64_75747.3
Applied add-cube-cbrt_binary64_78347.1
Applied times-frac_binary64_75747.1
Simplified47.1
Taylor expanded around inf 15.1
Simplified15.1
if 1.1082609750789312e-166 < re < 1.4551030635736294e82Initial program 16.3
rmApplied pow1/2_binary64_82816.3
Applied log-pow_binary64_83716.3
Applied associate-/l*_binary64_69816.3
rmApplied pow1_binary64_80916.3
Applied log-pow_binary64_83716.3
Applied add-cube-cbrt_binary64_78316.9
Applied times-frac_binary64_75716.9
Applied add-cube-cbrt_binary64_78316.2
Applied times-frac_binary64_75716.2
Simplified16.2
Final simplification17.6
herbie shell --seed 2020292
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))