Average Error: 31.4 → 17.8
Time: 2.0m
Precision: 64
Internal Precision: 576
\[\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 -3.8471086307967804 \cdot 10^{+47}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;im \le -1.0584042714284356 \cdot 10^{-221}:\\ \;\;\;\;\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{if}\;im \le 1.436264493332393 \cdot 10^{-263}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;im \le 5.832785981965684 \cdot 10^{+76}:\\ \;\;\;\;\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if im < -3.8471086307967804e+47

    1. Initial program 43.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. Using strategy rm
    3. Applied clear-num43.4

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

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

      \[\leadsto \frac{1}{\frac{\log base \cdot \log base}{\log \color{blue}{\left(-1 \cdot im\right)} \cdot \log base}}\]
    6. Applied simplify10.9

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

    if -3.8471086307967804e+47 < im < -1.0584042714284356e-221 or 1.436264493332393e-263 < im < 5.832785981965684e+76

    1. Initial program 20.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. Using strategy rm
    3. Applied div-inv20.2

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

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

    if -1.0584042714284356e-221 < im < 1.436264493332393e-263

    1. Initial program 32.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. Taylor expanded around -inf 32.8

      \[\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 simplify32.8

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

    if 5.832785981965684e+76 < im

    1. Initial program 46.6

      \[\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 10.6

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

Runtime

Time bar (total: 2.0m)Debug logProfile

herbie shell --seed 2018195 
(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))))