\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\begin{array}{l}
\mathbf{if}\;re \leq -2.1174862849080903 \cdot 10^{+60}:\\
\;\;\;\;\frac{0.5}{\sqrt{\log 10}} \cdot \left(-2 \cdot \left(\log \left(\frac{-1}{re}\right) \cdot \sqrt{\frac{1}{\log 10}}\right)\right)\\
\mathbf{elif}\;re \leq 1.0865722709223886 \cdot 10^{+74}:\\
\;\;\;\;\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{0.5}{\sqrt{\log 10}}} \cdot \left(\sqrt{\frac{0.5}{\sqrt{\log 10}}} \cdot \frac{2 \cdot \log re}{\sqrt{\log 10}}\right)\\
\end{array}(FPCore (re im) :precision binary64 (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
(FPCore (re im)
:precision binary64
(if (<= re -2.1174862849080903e+60)
(*
(/ 0.5 (sqrt (log 10.0)))
(* -2.0 (* (log (/ -1.0 re)) (sqrt (/ 1.0 (log 10.0))))))
(if (<= re 1.0865722709223886e+74)
(* (sqrt 0.5) (/ (sqrt 0.5) (/ (log 10.0) (log (+ (* re re) (* im im))))))
(*
(sqrt (/ 0.5 (sqrt (log 10.0))))
(*
(sqrt (/ 0.5 (sqrt (log 10.0))))
(/ (* 2.0 (log re)) (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) {
double tmp;
if (re <= -2.1174862849080903e+60) {
tmp = (0.5 / sqrt(log(10.0))) * (-2.0 * (log(-1.0 / re) * sqrt(1.0 / log(10.0))));
} else if (re <= 1.0865722709223886e+74) {
tmp = sqrt(0.5) * (sqrt(0.5) / (log(10.0) / log((re * re) + (im * im))));
} else {
tmp = sqrt(0.5 / sqrt(log(10.0))) * (sqrt(0.5 / sqrt(log(10.0))) * ((2.0 * log(re)) / sqrt(log(10.0))));
}
return tmp;
}



Bits error versus re



Bits error versus im
Results
if re < -2.1174862849080903e60Initial program 46.1
rmApplied add-sqr-sqrt_binary6446.1
Applied pow1/2_binary6446.1
Applied log-pow_binary6446.1
Applied times-frac_binary6446.1
Taylor expanded around -inf 10.3
if -2.1174862849080903e60 < re < 1.086572270922389e74Initial program 22.0
rmApplied add-sqr-sqrt_binary6422.0
Applied pow1/2_binary6422.0
Applied log-pow_binary6422.0
Applied times-frac_binary6422.0
rmApplied *-un-lft-identity_binary6422.0
Applied add-sqr-sqrt_binary6422.0
Applied times-frac_binary6422.0
Applied associate-*l*_binary6421.9
Simplified22.0
if 1.086572270922389e74 < re Initial program 47.3
rmApplied add-sqr-sqrt_binary6447.3
Applied pow1/2_binary6447.3
Applied log-pow_binary6447.3
Applied times-frac_binary6447.3
rmApplied add-sqr-sqrt_binary6447.3
Applied associate-*l*_binary6447.3
Simplified47.3
Taylor expanded around inf 10.7
Simplified10.7
Final simplification17.3
herbie shell --seed 2020232
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))