Average Error: 30.8 → 0.4
Time: 56.2s
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}{\frac{\log base}{\log \left(\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{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}
double f(double re, double im, double base) {
        double r1035647 = re;
        double r1035648 = r1035647 * r1035647;
        double r1035649 = im;
        double r1035650 = r1035649 * r1035649;
        double r1035651 = r1035648 + r1035650;
        double r1035652 = sqrt(r1035651);
        double r1035653 = log(r1035652);
        double r1035654 = base;
        double r1035655 = log(r1035654);
        double r1035656 = r1035653 * r1035655;
        double r1035657 = atan2(r1035649, r1035647);
        double r1035658 = 0.0;
        double r1035659 = r1035657 * r1035658;
        double r1035660 = r1035656 + r1035659;
        double r1035661 = r1035655 * r1035655;
        double r1035662 = r1035658 * r1035658;
        double r1035663 = r1035661 + r1035662;
        double r1035664 = r1035660 / r1035663;
        return r1035664;
}

double f(double re, double im, double base) {
        double r1035665 = 1.0;
        double r1035666 = base;
        double r1035667 = log(r1035666);
        double r1035668 = re;
        double r1035669 = im;
        double r1035670 = hypot(r1035668, r1035669);
        double r1035671 = log(r1035670);
        double r1035672 = r1035667 / r1035671;
        double r1035673 = r1035665 / r1035672;
        return r1035673;
}

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.8

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity0.4

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

    \[\leadsto \color{blue}{\frac{1}{\frac{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}{1}}}\]
  9. Simplified0.4

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

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

Reproduce

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