Average Error: 32.2 → 18.3
Time: 17.3s
Precision: binary64
Cost: 66500
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
↓
\[\begin{array}{l}
\mathbf{if}\;re \leq -7.957190502393604 \cdot 10^{+89}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}\\
\mathbf{elif}\;re \leq -3.396417318103129 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{elif}\;re \leq 1.5808915944341867 \cdot 10^{-181}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 3.5515048939018026 \cdot 10^{+132}:\\
\;\;\;\;\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)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}↓
\begin{array}{l}
\mathbf{if}\;re \leq -7.957190502393604 \cdot 10^{+89}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}\\
\mathbf{elif}\;re \leq -3.396417318103129 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{elif}\;re \leq 1.5808915944341867 \cdot 10^{-181}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 3.5515048939018026 \cdot 10^{+132}:\\
\;\;\;\;\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)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}(FPCore (re im)
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
↓
(FPCore (re im)
:precision binary64
(if (<= re -7.957190502393604e+89)
(/ (sqrt 0.5) (/ (log 10.0) (* (sqrt 0.5) (* -2.0 (log (/ -1.0 re))))))
(if (<= re -3.396417318103129e-304)
(* (sqrt 0.5) (/ (sqrt 0.5) (/ (log 10.0) (log (+ (* re re) (* im im))))))
(if (<= re 1.5808915944341867e-181)
(/ (sqrt 0.5) (/ (log 10.0) (* (sqrt 0.5) (* -2.0 (log (/ -1.0 im))))))
(if (<= re 3.5515048939018026e+132)
(*
(/ (* (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))))))
(/
(sqrt 0.5)
(* -0.5 (/ (log 10.0) (* (sqrt 0.5) (- (log re)))))))))))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 <= -7.957190502393604e+89) {
tmp = sqrt(0.5) / (log(10.0) / (sqrt(0.5) * (-2.0 * log(-1.0 / re))));
} else if (re <= -3.396417318103129e-304) {
tmp = sqrt(0.5) * (sqrt(0.5) / (log(10.0) / log((re * re) + (im * im))));
} else if (re <= 1.5808915944341867e-181) {
tmp = sqrt(0.5) / (log(10.0) / (sqrt(0.5) * (-2.0 * log(-1.0 / im))));
} else if (re <= 3.5515048939018026e+132) {
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))));
} else {
tmp = sqrt(0.5) / (-0.5 * (log(10.0) / (sqrt(0.5) * -log(re))));
}
return tmp;
}
Try it out
Enter valid numbers for all inputs
Alternatives
| Alternative 1 |
|---|
| Error | 18.3 |
|---|
| Cost | 27716 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -3.8230971066908273 \cdot 10^{+89}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}\\
\mathbf{elif}\;re \leq -2.0587136117511207 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{elif}\;re \leq 1.4612152070729814 \cdot 10^{-183}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 1.0813851646160545 \cdot 10^{+133}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
| Alternative 2 |
|---|
| Error | 18.3 |
|---|
| Cost | 27716 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -1.7092302464501153 \cdot 10^{+84}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}\\
\mathbf{elif}\;re \leq -1.341759796267171 \cdot 10^{-305}:\\
\;\;\;\;\frac{3}{\frac{\log 10}{\log \left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right)}}\\
\mathbf{elif}\;re \leq 1.5100632843712227 \cdot 10^{-181}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 1.748985785853791 \cdot 10^{+131}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
| Alternative 3 |
|---|
| Error | 18.3 |
|---|
| Cost | 27524 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -3.1949520550424426 \cdot 10^{+84}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}\\
\mathbf{elif}\;re \leq -1.14882176169717 \cdot 10^{-305}:\\
\;\;\;\;\frac{3}{\frac{\log 10}{\log \left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right)}}\\
\mathbf{elif}\;re \leq 2.589049802161673 \cdot 10^{-183}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 2.3275519908472327 \cdot 10^{+131}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
| Alternative 4 |
|---|
| Error | 18.4 |
|---|
| Cost | 27524 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -1.2541583614703662 \cdot 10^{+84}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}\\
\mathbf{elif}\;re \leq -6.64588331996408 \cdot 10^{-304}:\\
\;\;\;\;0.5 \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\log 10}\\
\mathbf{elif}\;re \leq 5.175353787195054 \cdot 10^{-183}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 2.1597781474088058 \cdot 10^{+132}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
| Alternative 5 |
|---|
| Error | 18.3 |
|---|
| Cost | 27524 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -4.9038143526604607 \cdot 10^{+89}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;re \leq -3.749303227302988 \cdot 10^{-305}:\\
\;\;\;\;0.5 \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\log 10}\\
\mathbf{elif}\;re \leq 4.151622206787763 \cdot 10^{-181}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 1.5384294376496345 \cdot 10^{+132}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
| Alternative 6 |
|---|
| Error | 18.3 |
|---|
| Cost | 27524 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -7.416831879408788 \cdot 10^{+89}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;re \leq -5.256911607223242 \cdot 10^{-305}:\\
\;\;\;\;0.5 \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\log 10}\\
\mathbf{elif}\;re \leq 2.699719036635054 \cdot 10^{-183}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;re \leq 5.421008368769625 \cdot 10^{+131}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
| Alternative 7 |
|---|
| Error | 18.3 |
|---|
| Cost | 14788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -5.795756010454339 \cdot 10^{+89}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;re \leq -6.285914458263249 \cdot 10^{-305}:\\
\;\;\;\;0.5 \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\log 10}\\
\mathbf{elif}\;re \leq 7.9088512795762 \cdot 10^{-182}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;re \leq 2.0686566951142447 \cdot 10^{+131}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{-0.5 \cdot \frac{\log 10}{-\log re}}\\
\end{array}\]
| Alternative 8 |
|---|
| Error | 18.4 |
|---|
| Cost | 14788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -5.255397387469522 \cdot 10^{+89}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;re \leq -1.1175447774881049 \cdot 10^{-304}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{elif}\;re \leq 1.3001277567494677 \cdot 10^{-182}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;re \leq 9.26708196289371 \cdot 10^{+131}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{-0.5 \cdot \frac{\log 10}{-\log re}}\\
\end{array}\]
| Alternative 9 |
|---|
| Error | 23.9 |
|---|
| Cost | 15816 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.2417036622411211 \cdot 10^{-56}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;im \leq -3.767766824219734 \cdot 10^{-126}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;im \leq -4.29601264620126 \cdot 10^{-142}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;im \leq -6.887443022145891 \cdot 10^{-242}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\mathbf{elif}\;im \leq -3.940313326110668 \cdot 10^{-269}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;im \leq 2.3778016643234542 \cdot 10^{-284}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\mathbf{elif}\;im \leq 1.0714898969958725 \cdot 10^{-273}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;im \leq 8.652535386165096 \cdot 10^{-72}:\\
\;\;\;\;\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log im}{\log 10}\\
\end{array}\]
| Alternative 10 |
|---|
| Error | 24.7 |
|---|
| Cost | 15560 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -3.402873198778472 \cdot 10^{-57}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;im \leq -2.8179583370122537 \cdot 10^{-127}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;im \leq -1.6925218008705358 \cdot 10^{-141}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;im \leq -2.6620241004041015 \cdot 10^{-241}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\mathbf{elif}\;im \leq -7.953281208305644 \cdot 10^{-269}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;im \leq 1.9416406107261096 \cdot 10^{-284}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\mathbf{elif}\;im \leq 5.8049964218187595 \cdot 10^{-272}:\\
\;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\
\mathbf{elif}\;im \leq 1.3066790705255886 \cdot 10^{-174}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log im}{\log 10}\\
\end{array}\]
| Alternative 11 |
|---|
| Error | 24.9 |
|---|
| Cost | 13634 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -6.319268992154543 \cdot 10^{-142}:\\
\;\;\;\;\frac{\log \left(-im\right)}{\log 10}\\
\mathbf{elif}\;im \leq 2.5173148715042562 \cdot 10^{-174}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log im}{\log 10}\\
\end{array}\]
| Alternative 12 |
|---|
| Error | 36.0 |
|---|
| Cost | 13313 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq 1.4452463921379706 \cdot 10^{-173}:\\
\;\;\;\;\frac{\log im}{\log 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\end{array}\]
| Alternative 13 |
|---|
| Error | 43.0 |
|---|
| Cost | 13313 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq 1.08511105960776 \cdot 10^{-309}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\log re}{\log 10}\\
\end{array}\]
| Alternative 14 |
|---|
| Error | 56.8 |
|---|
| Cost | 64 |
|---|
\[1\]
Error

Derivation
- Split input into 5 regimes
if re < -7.957190502393604e89
Initial program 49.8
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
- Using strategy
rm Applied pow1/2_binary64_84049.8
\[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{0.5}\right)}}{\log 10}\]
Applied log-pow_binary64_84949.8
\[\leadsto \frac{\color{blue}{0.5 \cdot \log \left(re \cdot re + im \cdot im\right)}}{\log 10}\]
Applied associate-/l*_binary64_70549.8
\[\leadsto \color{blue}{\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
- Using strategy
rm Applied add-sqr-sqrt_binary64_78249.8
\[\leadsto \frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\]
Applied associate-/l*_binary64_70549.8
\[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\frac{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}{\sqrt{0.5}}}}\]
Simplified49.8
\[\leadsto \frac{\sqrt{0.5}}{\color{blue}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right) \cdot \sqrt{0.5}}}}\]
Taylor expanded around -inf 10.4
\[\leadsto \frac{\sqrt{0.5}}{\frac{\log 10}{\color{blue}{\left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)} \cdot \sqrt{0.5}}}\]
Simplified10.4
\[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}}\]
if -7.957190502393604e89 < re < -3.39641731810312884e-304
Initial program 23.0
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
- Using strategy
rm Applied pow1/2_binary64_84023.0
\[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{0.5}\right)}}{\log 10}\]
Applied log-pow_binary64_84923.0
\[\leadsto \frac{\color{blue}{0.5 \cdot \log \left(re \cdot re + im \cdot im\right)}}{\log 10}\]
Applied associate-/l*_binary64_70523.0
\[\leadsto \color{blue}{\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
- Using strategy
rm Applied pow1_binary64_82123.0
\[\leadsto \frac{0.5}{\frac{\log 10}{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{1}\right)}}}\]
Applied log-pow_binary64_84923.0
\[\leadsto \frac{0.5}{\frac{\log 10}{\color{blue}{1 \cdot \log \left(re \cdot re + im \cdot im\right)}}}\]
Applied pow1_binary64_82123.0
\[\leadsto \frac{0.5}{\frac{\log \color{blue}{\left({10}^{1}\right)}}{1 \cdot \log \left(re \cdot re + im \cdot im\right)}}\]
Applied log-pow_binary64_84923.0
\[\leadsto \frac{0.5}{\frac{\color{blue}{1 \cdot \log 10}}{1 \cdot \log \left(re \cdot re + im \cdot im\right)}}\]
Applied times-frac_binary64_76623.0
\[\leadsto \frac{0.5}{\color{blue}{\frac{1}{1} \cdot \frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
Applied add-sqr-sqrt_binary64_78223.1
\[\leadsto \frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{\frac{1}{1} \cdot \frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\]
Applied times-frac_binary64_76622.9
\[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\frac{1}{1}} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
Simplified22.9
\[\leadsto \color{blue}{\sqrt{0.5}} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\]
Simplified22.9
\[\leadsto \color{blue}{\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
if -3.39641731810312884e-304 < re < 1.5808915944341867e-181
Initial program 32.4
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
- Using strategy
rm Applied pow1/2_binary64_84032.4
\[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{0.5}\right)}}{\log 10}\]
Applied log-pow_binary64_84932.4
\[\leadsto \frac{\color{blue}{0.5 \cdot \log \left(re \cdot re + im \cdot im\right)}}{\log 10}\]
Applied associate-/l*_binary64_70532.4
\[\leadsto \color{blue}{\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
- Using strategy
rm Applied add-sqr-sqrt_binary64_78232.5
\[\leadsto \frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\]
Applied associate-/l*_binary64_70532.3
\[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\frac{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}{\sqrt{0.5}}}}\]
Simplified32.3
\[\leadsto \frac{\sqrt{0.5}}{\color{blue}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right) \cdot \sqrt{0.5}}}}\]
Taylor expanded around -inf 33.8
\[\leadsto \frac{\sqrt{0.5}}{\frac{\log 10}{\color{blue}{\left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)} \cdot \sqrt{0.5}}}\]
Simplified33.8
\[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}}\]
if 1.5808915944341867e-181 < re < 3.55150489390180262e132
Initial program 17.0
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
- Using strategy
rm Applied pow1/2_binary64_84017.0
\[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{0.5}\right)}}{\log 10}\]
Applied log-pow_binary64_84917.0
\[\leadsto \frac{\color{blue}{0.5 \cdot \log \left(re \cdot re + im \cdot im\right)}}{\log 10}\]
Applied associate-/l*_binary64_70517.0
\[\leadsto \color{blue}{\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
- Using strategy
rm Applied pow1_binary64_82117.0
\[\leadsto \frac{0.5}{\frac{\log 10}{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{1}\right)}}}\]
Applied log-pow_binary64_84917.0
\[\leadsto \frac{0.5}{\frac{\log 10}{\color{blue}{1 \cdot \log \left(re \cdot re + im \cdot im\right)}}}\]
Applied add-cube-cbrt_binary64_79517.6
\[\leadsto \frac{0.5}{\frac{\color{blue}{\left(\sqrt[3]{\log 10} \cdot \sqrt[3]{\log 10}\right) \cdot \sqrt[3]{\log 10}}}{1 \cdot \log \left(re \cdot re + im \cdot im\right)}}\]
Applied times-frac_binary64_76617.6
\[\leadsto \frac{0.5}{\color{blue}{\frac{\sqrt[3]{\log 10} \cdot \sqrt[3]{\log 10}}{1} \cdot \frac{\sqrt[3]{\log 10}}{\log \left(re \cdot re + im \cdot im\right)}}}\]
Applied add-cube-cbrt_binary64_79516.9
\[\leadsto \frac{\color{blue}{\left(\sqrt[3]{0.5} \cdot \sqrt[3]{0.5}\right) \cdot \sqrt[3]{0.5}}}{\frac{\sqrt[3]{\log 10} \cdot \sqrt[3]{\log 10}}{1} \cdot \frac{\sqrt[3]{\log 10}}{\log \left(re \cdot re + im \cdot im\right)}}\]
Applied times-frac_binary64_76616.9
\[\leadsto \color{blue}{\frac{\sqrt[3]{0.5} \cdot \sqrt[3]{0.5}}{\frac{\sqrt[3]{\log 10} \cdot \sqrt[3]{\log 10}}{1}} \cdot \frac{\sqrt[3]{0.5}}{\frac{\sqrt[3]{\log 10}}{\log \left(re \cdot re + im \cdot im\right)}}}\]
Simplified16.9
\[\leadsto \color{blue}{\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)}}\]
Simplified16.9
\[\leadsto \color{blue}{\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)}}}\]
if 3.55150489390180262e132 < re
Initial program 58.4
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
- Using strategy
rm Applied pow1/2_binary64_84058.4
\[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{0.5}\right)}}{\log 10}\]
Applied log-pow_binary64_84958.4
\[\leadsto \frac{\color{blue}{0.5 \cdot \log \left(re \cdot re + im \cdot im\right)}}{\log 10}\]
Applied associate-/l*_binary64_70558.4
\[\leadsto \color{blue}{\frac{0.5}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}}\]
- Using strategy
rm Applied add-sqr-sqrt_binary64_78258.5
\[\leadsto \frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\]
Applied associate-/l*_binary64_70558.5
\[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\frac{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}{\sqrt{0.5}}}}\]
Simplified58.4
\[\leadsto \frac{\sqrt{0.5}}{\color{blue}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right) \cdot \sqrt{0.5}}}}\]
Taylor expanded around inf 8.1
\[\leadsto \frac{\sqrt{0.5}}{\color{blue}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \log \left(\frac{1}{re}\right)}}}\]
Simplified8.1
\[\leadsto \frac{\sqrt{0.5}}{\color{blue}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}}\]
Simplified8.1
\[\leadsto \color{blue}{\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}}\]
- Recombined 5 regimes into one program.
Final simplification18.3
\[\leadsto \begin{array}{l}
\mathbf{if}\;re \leq -7.957190502393604 \cdot 10^{+89}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{re}\right)\right)}}\\
\mathbf{elif}\;re \leq -3.396417318103129 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{\frac{\log 10}{\log \left(re \cdot re + im \cdot im\right)}}\\
\mathbf{elif}\;re \leq 1.5808915944341867 \cdot 10^{-181}:\\
\;\;\;\;\frac{\sqrt{0.5}}{\frac{\log 10}{\sqrt{0.5} \cdot \left(-2 \cdot \log \left(\frac{-1}{im}\right)\right)}}\\
\mathbf{elif}\;re \leq 3.5515048939018026 \cdot 10^{+132}:\\
\;\;\;\;\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)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5}}{-0.5 \cdot \frac{\log 10}{\sqrt{0.5} \cdot \left(-\log re\right)}}\\
\end{array}\]
Reproduce
herbie shell --seed 2021044
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))