Average Error: 31.1 → 17.5
Time: 59.6s
Precision: 64
Internal Precision: 384
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
\[\begin{array}{l} \mathbf{if}\;-re \le -1.3941550756848977 \cdot 10^{+137}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \mathbf{if}\;-re \le -9.263427014381762 \cdot 10^{-214}:\\ \;\;\;\;\frac{\log \left(\left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}} \cdot \sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right) \cdot {\left(\sqrt{re \cdot re + im \cdot im}\right)}^{\frac{1}{3}}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\\ \mathbf{if}\;-re \le 8.691361779412498 \cdot 10^{-161}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-re \le 3.1469962424155095 \cdot 10^{+112}:\\ \;\;\;\;\frac{\log \left(\left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}} \cdot \sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right) \cdot {\left(\sqrt{re \cdot re + im \cdot im}\right)}^{\frac{1}{3}}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Split input into 4 regimes
  2. if (- re) < -1.3941550756848977e+137

    1. Initial program 57.9

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    2. Taylor expanded around inf 7.2

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

      \[\leadsto \color{blue}{\frac{-\log re}{-\log base}}\]

    if -1.3941550756848977e+137 < (- re) < -9.263427014381762e-214 or 8.691361779412498e-161 < (- re) < 3.1469962424155095e+112

    1. Initial program 16.8

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt16.9

      \[\leadsto \frac{\log \color{blue}{\left(\left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}} \cdot \sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right) \cdot \sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right)} \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    4. Using strategy rm
    5. Applied pow1/316.9

      \[\leadsto \frac{\log \left(\left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}} \cdot \sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right) \cdot \color{blue}{{\left(\sqrt{re \cdot re + im \cdot im}\right)}^{\frac{1}{3}}}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]

    if -9.263427014381762e-214 < (- re) < 8.691361779412498e-161

    1. Initial program 30.4

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    2. Taylor expanded around 0 34.1

      \[\leadsto \color{blue}{\frac{\log im}{\log base}}\]

    if 3.1469962424155095e+112 < (- re)

    1. Initial program 53.0

      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    2. Taylor expanded around -inf 8.9

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot re\right)} \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    3. Applied simplify8.8

      \[\leadsto \color{blue}{\frac{\log \left(-re\right)}{\log base}}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 59.6s)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' 
(FPCore (re im base)
  :name "math.log/2 on complex, real part"
  (/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0)) (+ (* (log base) (log base)) (* 0 0))))