Average Error: 30.6 → 0.4
Time: 52.0s
Precision: 64
\[\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}\]
\[\frac{1}{\log base} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot e^{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}\right)\]
\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}
\frac{1}{\log base} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot e^{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}\right)
double f(double re, double im, double base) {
        double r603471 = re;
        double r603472 = r603471 * r603471;
        double r603473 = im;
        double r603474 = r603473 * r603473;
        double r603475 = r603472 + r603474;
        double r603476 = sqrt(r603475);
        double r603477 = log(r603476);
        double r603478 = base;
        double r603479 = log(r603478);
        double r603480 = r603477 * r603479;
        double r603481 = atan2(r603473, r603471);
        double r603482 = 0.0;
        double r603483 = r603481 * r603482;
        double r603484 = r603480 + r603483;
        double r603485 = r603479 * r603479;
        double r603486 = r603482 * r603482;
        double r603487 = r603485 + r603486;
        double r603488 = r603484 / r603487;
        return r603488;
}

double f(double re, double im, double base) {
        double r603489 = 1.0;
        double r603490 = base;
        double r603491 = log(r603490);
        double r603492 = r603489 / r603491;
        double r603493 = re;
        double r603494 = im;
        double r603495 = hypot(r603493, r603494);
        double r603496 = cbrt(r603495);
        double r603497 = log(r603496);
        double r603498 = r603497 + r603497;
        double r603499 = exp(r603498);
        double r603500 = r603496 * r603499;
        double r603501 = log(r603500);
        double r603502 = r603492 * r603501;
        return r603502;
}

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. Initial program 30.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. Simplified0.4

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}}\]
  3. Using strategy rm
  4. Applied div-inv0.4

    \[\leadsto \color{blue}{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \frac{1}{\log base}}\]
  5. Using strategy rm
  6. Applied add-cube-cbrt0.4

    \[\leadsto \log \color{blue}{\left(\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)} \cdot \frac{1}{\log base}\]
  7. Using strategy rm
  8. Applied add-exp-log0.4

    \[\leadsto \log \left(\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \color{blue}{e^{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\log base}\]
  9. Applied add-exp-log0.4

    \[\leadsto \log \left(\left(\color{blue}{e^{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}} \cdot e^{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\log base}\]
  10. Applied prod-exp0.4

    \[\leadsto \log \left(\color{blue}{e^{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot \frac{1}{\log base}\]
  11. Final simplification0.4

    \[\leadsto \frac{1}{\log base} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot e^{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}\right)\]

Reproduce

herbie shell --seed 2019121 +o rules:numerics
(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))))