Average Error: 32.0 → 9.6
Time: 38.7s
Precision: 64
Internal precision: 128
\[\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}\;im \le -1.35445697581329:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;im \le -3.401067045531301 \cdot 10^{-250}:\\ \;\;\;\;\frac{1}{\sqrt[3]{{\left(\frac{\log base}{\log \left(\sqrt{{im}^2 + re \cdot re}\right)}\right)}^3}}\\ \mathbf{if}\;im \le 8.176379626678431 \cdot 10^{-212}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{if}\;im \le 9.615822446451964 \cdot 10^{+88}:\\ \;\;\;\;\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{\sqrt[3]{{\left({\left(\log base\right)}^2\right)}^3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Split input into 5 regimes.
  2. if im < -1.35445697581329

    1. Initial program 43.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. Applied simplify 43.0

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{{\left(\log base\right)}^2}}\]
    3. Applied taylor 0.5

      \[\leadsto \frac{\log \left(-1 \cdot im\right) \cdot \log base}{{\left(\log base\right)}^2}\]
    4. Taylor expanded around -inf 0.5

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot im\right)} \cdot \log base}{{\left(\log base\right)}^2}\]
    5. Applied simplify 0.4

      \[\leadsto \color{blue}{\frac{\log \left(-im\right)}{\log base}}\]

    if -1.35445697581329 < im < -3.401067045531301e-250

    1. Initial program 21.3

      \[\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. Applied simplify 21.3

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{{\left(\log base\right)}^2}}\]
    3. Using strategy rm
    4. Applied clear-num 21.3

      \[\leadsto \color{blue}{\frac{1}{\frac{{\left(\log base\right)}^2}{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}}}\]
    5. Applied simplify 21.2

      \[\leadsto \frac{1}{\color{blue}{\frac{\log base}{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}}}\]
    6. Using strategy rm
    7. Applied add-cbrt-cube 21.4

      \[\leadsto \frac{1}{\frac{\log base}{\color{blue}{\sqrt[3]{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3}}}}\]
    8. Applied add-cbrt-cube 21.5

      \[\leadsto \frac{1}{\frac{\color{blue}{\sqrt[3]{{\left(\log base\right)}^3}}}{\sqrt[3]{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3}}}\]
    9. Applied cbrt-undiv 21.4

      \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{\frac{{\left(\log base\right)}^3}{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3}}}}\]
    10. Applied simplify 21.4

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

    if -3.401067045531301e-250 < im < 8.176379626678431e-212

    1. Initial program 27.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. Applied simplify 27.8

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{{\left(\log base\right)}^2}}\]
    3. Applied taylor 0.4

      \[\leadsto \frac{\log re \cdot \log base}{{\left(\log base\right)}^2}\]
    4. Taylor expanded around 0 0.4

      \[\leadsto \frac{\log \color{blue}{re} \cdot \log base}{{\left(\log base\right)}^2}\]
    5. Applied simplify 0.3

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

    if 8.176379626678431e-212 < im < 9.615822446451964e+88

    1. Initial program 18.7

      \[\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. Applied simplify 18.7

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{{\left(\log base\right)}^2}}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube 18.8

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

    if 9.615822446451964e+88 < im

    1. Initial program 48.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. Applied simplify 48.4

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{{\left(\log base\right)}^2}}\]
    3. Applied taylor 0.5

      \[\leadsto \frac{\log im \cdot \log base}{{\left(\log base\right)}^2}\]
    4. Taylor expanded around inf 0.5

      \[\leadsto \frac{\log \color{blue}{im} \cdot \log base}{{\left(\log base\right)}^2}\]
    5. Applied simplify 0.4

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

Runtime

Time bar (total: 38.7s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(3896918242 1380950256 4026787927 1158530349 1063362842 2035271670)'
(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))))