Average Error: 31.0 → 0.4
Time: 2.2m
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 r2214518 = re;
        double r2214519 = r2214518 * r2214518;
        double r2214520 = im;
        double r2214521 = r2214520 * r2214520;
        double r2214522 = r2214519 + r2214521;
        double r2214523 = sqrt(r2214522);
        double r2214524 = log(r2214523);
        double r2214525 = base;
        double r2214526 = log(r2214525);
        double r2214527 = r2214524 * r2214526;
        double r2214528 = atan2(r2214520, r2214518);
        double r2214529 = 0.0;
        double r2214530 = r2214528 * r2214529;
        double r2214531 = r2214527 + r2214530;
        double r2214532 = r2214526 * r2214526;
        double r2214533 = r2214529 * r2214529;
        double r2214534 = r2214532 + r2214533;
        double r2214535 = r2214531 / r2214534;
        return r2214535;
}

double f(double re, double im, double base) {
        double r2214536 = 1.0;
        double r2214537 = base;
        double r2214538 = log(r2214537);
        double r2214539 = re;
        double r2214540 = im;
        double r2214541 = hypot(r2214539, r2214540);
        double r2214542 = log(r2214541);
        double r2214543 = r2214538 / r2214542;
        double r2214544 = r2214536 / r2214543;
        return r2214544;
}

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

    \[\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 *-un-lft-identity0.4

    \[\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. Final simplification0.4

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

Reproduce

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