Average Error: 31.3 → 0.4
Time: 22.6s
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{3}{\frac{\log base}{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\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{3}{\frac{\log base}{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}}
double f(double re, double im, double base) {
        double r2118694 = re;
        double r2118695 = r2118694 * r2118694;
        double r2118696 = im;
        double r2118697 = r2118696 * r2118696;
        double r2118698 = r2118695 + r2118697;
        double r2118699 = sqrt(r2118698);
        double r2118700 = log(r2118699);
        double r2118701 = base;
        double r2118702 = log(r2118701);
        double r2118703 = r2118700 * r2118702;
        double r2118704 = atan2(r2118696, r2118694);
        double r2118705 = 0.0;
        double r2118706 = r2118704 * r2118705;
        double r2118707 = r2118703 + r2118706;
        double r2118708 = r2118702 * r2118702;
        double r2118709 = r2118705 * r2118705;
        double r2118710 = r2118708 + r2118709;
        double r2118711 = r2118707 / r2118710;
        return r2118711;
}

double f(double re, double im, double base) {
        double r2118712 = 3.0;
        double r2118713 = base;
        double r2118714 = log(r2118713);
        double r2118715 = re;
        double r2118716 = im;
        double r2118717 = hypot(r2118715, r2118716);
        double r2118718 = cbrt(r2118717);
        double r2118719 = log(r2118718);
        double r2118720 = r2118714 / r2118719;
        double r2118721 = r2118712 / r2118720;
        return r2118721;
}

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 31.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. Simplified0.4

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

    \[\leadsto \frac{\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)}}{\log base}\]
  5. Applied log-prod0.5

    \[\leadsto \frac{\color{blue}{\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}}{\log base}\]
  6. Simplified0.5

    \[\leadsto \frac{\color{blue}{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)} + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}{\log base}\]
  7. Using strategy rm
  8. Applied count-20.5

    \[\leadsto \frac{\color{blue}{2 \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)} + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}{\log base}\]
  9. Applied distribute-lft1-in0.5

    \[\leadsto \frac{\color{blue}{\left(2 + 1\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}}{\log base}\]
  10. Applied associate-/l*0.4

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

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

Reproduce

herbie shell --seed 2019163 +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))))