Average Error: 30.8 → 17.3
Time: 1.7m
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}\;im \le -5.297502446684092 \cdot 10^{+137}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;im \le 7.542336741115368 \cdot 10^{+32}:\\ \;\;\;\;\sqrt[3]{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{{\left(\log base\right)}^{3}} \cdot \left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right)}\\ \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 3 regimes
  2. if im < -5.297502446684092e+137

    1. Initial program 58.1

      \[\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 simplify58.1

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

      \[\leadsto \frac{\log base \cdot \log \color{blue}{\left(-1 \cdot im\right)}}{\log base \cdot \log base}\]
    4. Applied simplify7.7

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

    if -5.297502446684092e+137 < im < 7.542336741115368e+32

    1. Initial program 21.2

      \[\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 simplify21.2

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

      \[\leadsto \frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base \cdot \color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}}}\]
    5. Applied add-cbrt-cube21.6

      \[\leadsto \frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}} \cdot \sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}}\]
    6. Applied cbrt-unprod21.4

      \[\leadsto \frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\color{blue}{\sqrt[3]{\left(\left(\log base \cdot \log base\right) \cdot \log base\right) \cdot \left(\left(\log base \cdot \log base\right) \cdot \log base\right)}}}\]
    7. Applied add-cbrt-cube21.5

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) \cdot \left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)\right) \cdot \left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}}}{\sqrt[3]{\left(\left(\log base \cdot \log base\right) \cdot \log base\right) \cdot \left(\left(\log base \cdot \log base\right) \cdot \log base\right)}}\]
    8. Applied cbrt-undiv21.4

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) \cdot \left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)\right) \cdot \left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}{\left(\left(\log base \cdot \log base\right) \cdot \log base\right) \cdot \left(\left(\log base \cdot \log base\right) \cdot \log base\right)}}}\]
    9. Applied simplify21.4

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

    if 7.542336741115368e+32 < im

    1. Initial program 41.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 simplify41.3

      \[\leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base \cdot \log base}}\]
    3. Taylor expanded around inf 11.8

      \[\leadsto \frac{\log base \cdot \log \color{blue}{im}}{\log base \cdot \log base}\]
    4. Applied simplify11.7

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

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1063185673 2139736501 2393378123 1907444849 1070993796 1007244912)' 
(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))))