\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\begin{array}{l}
\mathbf{if}\;re \leq -6.5452086884385746 \cdot 10^{+75}:\\
\;\;\;\;\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.376243184252727 \cdot 10^{-175}:\\
\;\;\;\;\frac{\sqrt[3]{0.5} \cdot \sqrt[3]{0.5}}{\sqrt{\sqrt{\log 10}}} \cdot \left(\frac{\log \left(re \cdot re + im \cdot im\right)}{\sqrt{\log 10}} \cdot \frac{\sqrt[3]{0.5}}{\sqrt{\sqrt{\log 10}}}\right)\\
\mathbf{elif}\;re \leq -1.199094603442337 \cdot 10^{-193}:\\
\;\;\;\;\frac{\sqrt[3]{0.5} \cdot \sqrt[3]{0.5}}{\sqrt{\sqrt{\log 10}}} \cdot \left(\frac{\sqrt[3]{0.5}}{\sqrt{\sqrt{\log 10}}} \cdot \frac{-2 \cdot \log \left(\frac{-1}{re}\right)}{\sqrt{\log 10}}\right)\\
\mathbf{elif}\;re \leq 7.7571798384429 \cdot 10^{+129}:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{\sqrt[3]{0.5} \cdot \sqrt[3]{0.5}}{\sqrt{\sqrt{\log 10}}} \cdot \left(\frac{\sqrt[3]{0.5}}{\sqrt{\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 -6.5452086884385746e+75)
(*
(/ 0.5 (sqrt (log 10.0)))
(* -2.0 (* (log (/ -1.0 re)) (sqrt (/ 1.0 (log 10.0))))))
(if (<= re -1.376243184252727e-175)
(*
(/ (* (cbrt 0.5) (cbrt 0.5)) (sqrt (sqrt (log 10.0))))
(*
(/ (log (+ (* re re) (* im im))) (sqrt (log 10.0)))
(/ (cbrt 0.5) (sqrt (sqrt (log 10.0))))))
(if (<= re -1.199094603442337e-193)
(*
(/ (* (cbrt 0.5) (cbrt 0.5)) (sqrt (sqrt (log 10.0))))
(*
(/ (cbrt 0.5) (sqrt (sqrt (log 10.0))))
(/ (* -2.0 (log (/ -1.0 re))) (sqrt (log 10.0)))))
(if (<= re 7.7571798384429e+129)
(*
(/ 0.5 (sqrt (log 10.0)))
(log (pow (+ (* re re) (* im im)) (/ 1.0 (sqrt (log 10.0))))))
(*
(/ (* (cbrt 0.5) (cbrt 0.5)) (sqrt (sqrt (log 10.0))))
(*
(/ (cbrt 0.5) (sqrt (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 <= -6.5452086884385746e+75) {
tmp = (0.5 / sqrt(log(10.0))) * (-2.0 * (log(-1.0 / re) * sqrt(1.0 / log(10.0))));
} else if (re <= -1.376243184252727e-175) {
tmp = ((cbrt(0.5) * cbrt(0.5)) / sqrt(sqrt(log(10.0)))) * ((log((re * re) + (im * im)) / sqrt(log(10.0))) * (cbrt(0.5) / sqrt(sqrt(log(10.0)))));
} else if (re <= -1.199094603442337e-193) {
tmp = ((cbrt(0.5) * cbrt(0.5)) / sqrt(sqrt(log(10.0)))) * ((cbrt(0.5) / sqrt(sqrt(log(10.0)))) * ((-2.0 * log(-1.0 / re)) / sqrt(log(10.0))));
} else if (re <= 7.7571798384429e+129) {
tmp = (0.5 / sqrt(log(10.0))) * log(pow(((re * re) + (im * im)), (1.0 / sqrt(log(10.0)))));
} else {
tmp = ((cbrt(0.5) * cbrt(0.5)) / sqrt(sqrt(log(10.0)))) * ((cbrt(0.5) / sqrt(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 < -6.54520868843857457e75Initial program 48.1
rmApplied add-sqr-sqrt_binary64_9848.1
Applied pow1/2_binary64_15448.1
Applied log-pow_binary64_16348.1
Applied times-frac_binary64_8348.1
Taylor expanded around -inf 10.0
if -6.54520868843857457e75 < re < -1.376243184252727e-175Initial program 18.0
rmApplied add-sqr-sqrt_binary64_9818.0
Applied pow1/2_binary64_15418.0
Applied log-pow_binary64_16318.0
Applied times-frac_binary64_8318.0
rmApplied add-log-exp_binary64_11318.0
Simplified17.8
rmApplied add-sqr-sqrt_binary64_9818.4
Applied add-cube-cbrt_binary64_10917.8
Applied times-frac_binary64_8317.8
Applied associate-*l*_binary64_2017.9
Simplified17.9
if -1.376243184252727e-175 < re < -1.1990946034423369e-193Initial program 33.3
rmApplied add-sqr-sqrt_binary64_9833.3
Applied pow1/2_binary64_15433.3
Applied log-pow_binary64_16333.3
Applied times-frac_binary64_8333.3
rmApplied add-log-exp_binary64_11333.3
Simplified33.2
rmApplied add-sqr-sqrt_binary64_9833.6
Applied add-cube-cbrt_binary64_10933.2
Applied times-frac_binary64_8333.2
Applied associate-*l*_binary64_2033.2
Simplified33.2
Taylor expanded around -inf 44.3
Simplified44.3
if -1.1990946034423369e-193 < re < 7.7571798384428999e129Initial program 24.6
rmApplied add-sqr-sqrt_binary64_9824.6
Applied pow1/2_binary64_15424.6
Applied log-pow_binary64_16324.6
Applied times-frac_binary64_8324.5
rmApplied add-log-exp_binary64_11324.5
Simplified24.4
if 7.7571798384428999e129 < re Initial program 57.2
rmApplied add-sqr-sqrt_binary64_9857.2
Applied pow1/2_binary64_15457.2
Applied log-pow_binary64_16357.2
Applied times-frac_binary64_8357.2
rmApplied add-log-exp_binary64_11357.2
Simplified57.2
rmApplied add-sqr-sqrt_binary64_9857.2
Applied add-cube-cbrt_binary64_10957.2
Applied times-frac_binary64_8357.2
Applied associate-*l*_binary64_2057.2
Simplified57.2
Taylor expanded around inf 8.0
Simplified8.0
Final simplification18.3
herbie shell --seed 2020299
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))