Average Error: 31.3 → 0.4
Time: 24.1s
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 r2271401 = re;
        double r2271402 = r2271401 * r2271401;
        double r2271403 = im;
        double r2271404 = r2271403 * r2271403;
        double r2271405 = r2271402 + r2271404;
        double r2271406 = sqrt(r2271405);
        double r2271407 = log(r2271406);
        double r2271408 = base;
        double r2271409 = log(r2271408);
        double r2271410 = r2271407 * r2271409;
        double r2271411 = atan2(r2271403, r2271401);
        double r2271412 = 0.0;
        double r2271413 = r2271411 * r2271412;
        double r2271414 = r2271410 + r2271413;
        double r2271415 = r2271409 * r2271409;
        double r2271416 = r2271412 * r2271412;
        double r2271417 = r2271415 + r2271416;
        double r2271418 = r2271414 / r2271417;
        return r2271418;
}

double f(double re, double im, double base) {
        double r2271419 = 3.0;
        double r2271420 = base;
        double r2271421 = log(r2271420);
        double r2271422 = re;
        double r2271423 = im;
        double r2271424 = hypot(r2271422, r2271423);
        double r2271425 = cbrt(r2271424);
        double r2271426 = log(r2271425);
        double r2271427 = r2271421 / r2271426;
        double r2271428 = r2271419 / r2271427;
        return r2271428;
}

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))))