Average Error: 31.3 → 14.6
Time: 42.9s
Precision: 64
Ground Truth: 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}\;re \le -1.434851801692013 \cdot 10^{+69}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;re \le 2.355640365675785 \cdot 10^{+142}:\\ \;\;\;\;\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{1} \cdot \frac{1}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\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 re < -1.434851801692013e+69

    1. Initial program 45.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. Applied simplify 45.9

      \[\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 *-un-lft-identity 45.9

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

      \[\leadsto \frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{\color{blue}{{1}^2 \cdot {\left(\log base\right)}^2}}\]
    6. Applied times-frac 45.9

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

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

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

      \[\leadsto \frac{\log \left(-1 \cdot re\right)}{1} \cdot \frac{1}{\log base}\]
    10. Taylor expanded around -inf 0.4

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot re\right)}}{1} \cdot \frac{1}{\log base}\]
    11. Applied simplify 0.4

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

    if -1.434851801692013e+69 < re < 2.355640365675785e+142

    1. Initial program 21.5

      \[\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.5

      \[\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 *-un-lft-identity 21.5

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

      \[\leadsto \frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right) \cdot \log base}{\color{blue}{{1}^2 \cdot {\left(\log base\right)}^2}}\]
    6. Applied times-frac 21.5

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

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

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

    if 2.355640365675785e+142 < re

    1. Initial program 59.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 simplify 59.1

      \[\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 re \cdot \log base}{{\left(\log base\right)}^2}\]
    4. Taylor expanded around 0 0.5

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

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

Runtime

Total time: 42.9s Debug log

Please include this information when filing a bug report:

herbie --seed '#(1229168410 1411668335 838446457 373633370 4232796652 130706752)'
(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))))