Average Error: 31.1 → 17.0
Time: 45.7s
Precision: 64
Internal Precision: 384
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\begin{array}{l} \mathbf{if}\;re \le -3.4270952521715657 \cdot 10^{+143}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \mathbf{if}\;re \le 186086459.22255677:\\ \;\;\;\;\sqrt{\frac{\frac{1}{2}}{\sqrt{\log 10}}} \cdot \left(\sqrt{\frac{\frac{1}{2}}{\sqrt{\log 10}}} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\sqrt{\log 10}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log 10}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Derivation

  1. Split input into 3 regimes
  2. if re < -3.4270952521715657e+143

    1. Initial program 59.1

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
    2. Taylor expanded around -inf 7.3

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot re\right)}}{\log 10}\]
    3. Applied simplify7.3

      \[\leadsto \color{blue}{\frac{\log \left(-re\right)}{\log 10}}\]

    if -3.4270952521715657e+143 < re < 186086459.22255677

    1. Initial program 21.4

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt21.4

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\color{blue}{\sqrt{\log 10} \cdot \sqrt{\log 10}}}\]
    4. Applied pow1/221.4

      \[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{\frac{1}{2}}\right)}}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
    5. Applied log-pow21.4

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \log \left(re \cdot re + im \cdot im\right)}}{\sqrt{\log 10} \cdot \sqrt{\log 10}}\]
    6. Applied times-frac21.4

      \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\sqrt{\log 10}} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\sqrt{\log 10}}}\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt21.4

      \[\leadsto \color{blue}{\left(\sqrt{\frac{\frac{1}{2}}{\sqrt{\log 10}}} \cdot \sqrt{\frac{\frac{1}{2}}{\sqrt{\log 10}}}\right)} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\sqrt{\log 10}}\]
    9. Applied associate-*l*21.3

      \[\leadsto \color{blue}{\sqrt{\frac{\frac{1}{2}}{\sqrt{\log 10}}} \cdot \left(\sqrt{\frac{\frac{1}{2}}{\sqrt{\log 10}}} \cdot \frac{\log \left(re \cdot re + im \cdot im\right)}{\sqrt{\log 10}}\right)}\]

    if 186086459.22255677 < re

    1. Initial program 39.6

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
    2. Taylor expanded around inf 11.7

      \[\leadsto \frac{\log \color{blue}{re}}{\log 10}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 45.7s)Debug logProfile

herbie shell --seed '#(1063282112 2455465480 4141627379 3773598652 1647277307 776739644)' 
(FPCore (re im)
  :name "math.log10 on complex, real part"
  (/ (log (sqrt (+ (* re re) (* im im)))) (log 10)))