\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\begin{array}{l}
\mathbf{if}\;re \leq -1.810553704526183 \cdot 10^{+133}:\\
\;\;\;\;\sqrt{\frac{0.5}{\sqrt{\log 10}}} \cdot \left(\sqrt{\frac{0.5}{\sqrt{\log 10}}} \cdot \frac{\log \left(\frac{-1}{re}\right) \cdot -2}{\sqrt{\log 10}}\right)\\
\mathbf{elif}\;re \leq -6.923684505821139 \cdot 10^{-180}:\\
\;\;\;\;\frac{0.5}{\sqrt{\log 10}} \cdot \log \left({\left(re \cdot re + im \cdot im\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\\
\mathbf{elif}\;re \leq 6.406642900144384 \cdot 10^{-297}:\\
\;\;\;\;\frac{0.5}{\sqrt{\log 10}} \cdot \left(2 \cdot \left(\log im \cdot \sqrt{\frac{1}{\log 10}}\right)\right)\\
\mathbf{elif}\;re \leq 2.7773647014065815 \cdot 10^{+88}:\\
\;\;\;\;\frac{0.5}{\sqrt{\log 10}} \cdot \log \left({\left(re \cdot re + im \cdot im\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{0.5}{\sqrt{\log 10}}} \cdot \left(\left(2 \cdot \log re\right) \cdot \left(\sqrt{0.5} \cdot {\left(\frac{1}{{\log 10}^{3}}\right)}^{0.25}\right)\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.810553704526183e+133)
(*
(sqrt (/ 0.5 (sqrt (log 10.0))))
(*
(sqrt (/ 0.5 (sqrt (log 10.0))))
(/ (* (log (/ -1.0 re)) -2.0) (sqrt (log 10.0)))))
(if (<= re -6.923684505821139e-180)
(*
(/ 0.5 (sqrt (log 10.0)))
(log (pow (+ (* re re) (* im im)) (/ 1.0 (sqrt (log 10.0))))))
(if (<= re 6.406642900144384e-297)
(*
(/ 0.5 (sqrt (log 10.0)))
(* 2.0 (* (log im) (sqrt (/ 1.0 (log 10.0))))))
(if (<= re 2.7773647014065815e+88)
(*
(/ 0.5 (sqrt (log 10.0)))
(log (pow (+ (* re re) (* im im)) (/ 1.0 (sqrt (log 10.0))))))
(*
(sqrt (/ 0.5 (sqrt (log 10.0))))
(*
(* 2.0 (log re))
(* (sqrt 0.5) (pow (/ 1.0 (pow (log 10.0) 3.0)) 0.25)))))))))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.810553704526183e+133) {
tmp = sqrt(0.5 / sqrt(log(10.0))) * (sqrt(0.5 / sqrt(log(10.0))) * ((log(-1.0 / re) * -2.0) / sqrt(log(10.0))));
} else if (re <= -6.923684505821139e-180) {
tmp = (0.5 / sqrt(log(10.0))) * log(pow(((re * re) + (im * im)), (1.0 / sqrt(log(10.0)))));
} else if (re <= 6.406642900144384e-297) {
tmp = (0.5 / sqrt(log(10.0))) * (2.0 * (log(im) * sqrt(1.0 / log(10.0))));
} else if (re <= 2.7773647014065815e+88) {
tmp = (0.5 / sqrt(log(10.0))) * log(pow(((re * re) + (im * im)), (1.0 / sqrt(log(10.0)))));
} else {
tmp = sqrt(0.5 / sqrt(log(10.0))) * ((2.0 * log(re)) * (sqrt(0.5) * pow((1.0 / pow(log(10.0), 3.0)), 0.25)));
}
return tmp;
}



Bits error versus re



Bits error versus im
Results
if re < -1.8105537045261831e133Initial program 58.1
rmApplied add-sqr-sqrt_binary6458.1
Applied pow1/2_binary6458.1
Applied log-pow_binary6458.1
Applied times-frac_binary6458.1
rmApplied add-sqr-sqrt_binary6458.1
Applied associate-*l*_binary6458.1
Simplified58.1
Taylor expanded around -inf 7.6
Simplified7.6
if -1.8105537045261831e133 < re < -6.9236845058211389e-180 or 6.40664290014438439e-297 < re < 2.7773647014065815e88Initial program 20.0
rmApplied add-sqr-sqrt_binary6420.0
Applied pow1/2_binary6420.0
Applied log-pow_binary6420.0
Applied times-frac_binary6419.9
rmApplied add-log-exp_binary6419.9
Simplified19.7
if -6.9236845058211389e-180 < re < 6.40664290014438439e-297Initial program 30.4
rmApplied add-sqr-sqrt_binary6430.4
Applied pow1/2_binary6430.4
Applied log-pow_binary6430.4
Applied times-frac_binary6430.4
Taylor expanded around 0 33.7
if 2.7773647014065815e88 < re Initial program 48.0
rmApplied add-sqr-sqrt_binary6448.0
Applied pow1/2_binary6448.0
Applied log-pow_binary6448.0
Applied times-frac_binary6448.0
rmApplied add-sqr-sqrt_binary6448.0
Applied associate-*l*_binary6448.0
Simplified48.0
Taylor expanded around inf 8.6
Simplified8.5
Final simplification17.5
herbie shell --seed 2020233
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))