Average Error: 31.1 → 0.4
Time: 19.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{1}{\log base} \cdot \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}{\log base} \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)
double f(double re, double im, double base) {
        double r584338 = re;
        double r584339 = r584338 * r584338;
        double r584340 = im;
        double r584341 = r584340 * r584340;
        double r584342 = r584339 + r584341;
        double r584343 = sqrt(r584342);
        double r584344 = log(r584343);
        double r584345 = base;
        double r584346 = log(r584345);
        double r584347 = r584344 * r584346;
        double r584348 = atan2(r584340, r584338);
        double r584349 = 0.0;
        double r584350 = r584348 * r584349;
        double r584351 = r584347 + r584350;
        double r584352 = r584346 * r584346;
        double r584353 = r584349 * r584349;
        double r584354 = r584352 + r584353;
        double r584355 = r584351 / r584354;
        return r584355;
}

double f(double re, double im, double base) {
        double r584356 = 1.0;
        double r584357 = base;
        double r584358 = log(r584357);
        double r584359 = r584356 / r584358;
        double r584360 = re;
        double r584361 = im;
        double r584362 = hypot(r584360, r584361);
        double r584363 = log(r584362);
        double r584364 = r584359 * r584363;
        return r584364;
}

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

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

    \[\leadsto \frac{\log \color{blue}{\left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{1}\right)}}{\log base}\]
  5. Applied log-pow0.4

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

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  7. Using strategy rm
  8. Applied div-inv0.5

    \[\leadsto \frac{1}{\color{blue}{\log base \cdot \frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  9. Using strategy rm
  10. Applied associate-*r/0.4

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

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

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

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

Reproduce

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