Average Error: 30.6 → 0.6
Time: 1.3m
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}\]
\[\sqrt[3]{\left(\sqrt[3]{\left(\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\right) \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\right) \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}}\]
\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}
\sqrt[3]{\left(\sqrt[3]{\left(\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\right) \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\right) \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}}
double f(double re, double im, double base) {
        double r1122683 = re;
        double r1122684 = r1122683 * r1122683;
        double r1122685 = im;
        double r1122686 = r1122685 * r1122685;
        double r1122687 = r1122684 + r1122686;
        double r1122688 = sqrt(r1122687);
        double r1122689 = log(r1122688);
        double r1122690 = base;
        double r1122691 = log(r1122690);
        double r1122692 = r1122689 * r1122691;
        double r1122693 = atan2(r1122685, r1122683);
        double r1122694 = 0.0;
        double r1122695 = r1122693 * r1122694;
        double r1122696 = r1122692 + r1122695;
        double r1122697 = r1122691 * r1122691;
        double r1122698 = r1122694 * r1122694;
        double r1122699 = r1122697 + r1122698;
        double r1122700 = r1122696 / r1122699;
        return r1122700;
}

double f(double re, double im, double base) {
        double r1122701 = re;
        double r1122702 = im;
        double r1122703 = hypot(r1122701, r1122702);
        double r1122704 = log(r1122703);
        double r1122705 = base;
        double r1122706 = log(r1122705);
        double r1122707 = r1122704 / r1122706;
        double r1122708 = r1122707 * r1122707;
        double r1122709 = r1122708 * r1122707;
        double r1122710 = cbrt(r1122709);
        double r1122711 = r1122710 * r1122707;
        double r1122712 = r1122711 * r1122707;
        double r1122713 = cbrt(r1122712);
        return r1122713;
}

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 add-cbrt-cube0.7

    \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\right) \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}}}\]
  5. Using strategy rm
  6. Applied add-cbrt-cube0.6

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

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

Reproduce

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