Average Error: 57.5 → 55.9
Time: 22.5s
Precision: 64
Internal Precision: 320
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
\[\begin{array}{l} \mathbf{if}\;re \le -7.317903954721519 \cdot 10^{-279}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log 10}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if re < -7.317903954721519e-279

    1. Initial program 57.5

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
    2. Initial simplification57.5

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

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot re\right)}}{\log 10}\]
    4. Simplified55.6

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

    if -7.317903954721519e-279 < re

    1. Initial program 57.6

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
    2. Initial simplification57.6

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

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

      \[\leadsto \color{blue}{\frac{\log re}{\log 10}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -7.317903954721519 \cdot 10^{-279}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log 10}\\ \end{array}\]

Runtime

Time bar (total: 22.5s)Debug logProfile

herbie shell --seed 2018255 
(FPCore (re im)
  :name "math.log10 on complex, real part"
  (/ (log (sqrt (+ (* re re) (* im im)))) (log 10)))