Average Error: 31.6 → 0.4
Time: 52.5s
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{expm1}\left(\left(\mathsf{log1p}\left(\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right)\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{expm1}\left(\left(\mathsf{log1p}\left(\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right)\right)\right)}}
double f(double re, double im, double base) {
        double r1040425 = re;
        double r1040426 = r1040425 * r1040425;
        double r1040427 = im;
        double r1040428 = r1040427 * r1040427;
        double r1040429 = r1040426 + r1040428;
        double r1040430 = sqrt(r1040429);
        double r1040431 = log(r1040430);
        double r1040432 = base;
        double r1040433 = log(r1040432);
        double r1040434 = r1040431 * r1040433;
        double r1040435 = atan2(r1040427, r1040425);
        double r1040436 = 0.0;
        double r1040437 = r1040435 * r1040436;
        double r1040438 = r1040434 + r1040437;
        double r1040439 = r1040433 * r1040433;
        double r1040440 = r1040436 * r1040436;
        double r1040441 = r1040439 + r1040440;
        double r1040442 = r1040438 / r1040441;
        return r1040442;
}

double f(double re, double im, double base) {
        double r1040443 = 1.0;
        double r1040444 = base;
        double r1040445 = log(r1040444);
        double r1040446 = re;
        double r1040447 = im;
        double r1040448 = hypot(r1040446, r1040447);
        double r1040449 = log1p(r1040448);
        double r1040450 = expm1(r1040449);
        double r1040451 = log(r1040450);
        double r1040452 = r1040445 / r1040451;
        double r1040453 = r1040443 / r1040452;
        return r1040453;
}

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.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 expm1-log1p-u0.4

    \[\leadsto \frac{\log \color{blue}{\left(\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\mathsf{hypot}\left(re, im\right)\right)\right)\right)\right)\right)}}{\log base}\]
  5. Using strategy rm
  6. Applied clear-num0.4

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

    \[\leadsto \frac{1}{\color{blue}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}}\]
  8. Using strategy rm
  9. Applied expm1-log1p-u0.4

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

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

Reproduce

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