Average Error: 32.7 → 0.3
Time: 1.3m
Precision: 64
\[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
\[\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\]
\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}
\frac{\tan^{-1}_* \frac{im}{re}}{\log base}
double f(double re, double im, double base) {
        double r1864428 = im;
        double r1864429 = re;
        double r1864430 = atan2(r1864428, r1864429);
        double r1864431 = base;
        double r1864432 = log(r1864431);
        double r1864433 = r1864430 * r1864432;
        double r1864434 = r1864429 * r1864429;
        double r1864435 = r1864428 * r1864428;
        double r1864436 = r1864434 + r1864435;
        double r1864437 = sqrt(r1864436);
        double r1864438 = log(r1864437);
        double r1864439 = 0.0;
        double r1864440 = r1864438 * r1864439;
        double r1864441 = r1864433 - r1864440;
        double r1864442 = r1864432 * r1864432;
        double r1864443 = r1864439 * r1864439;
        double r1864444 = r1864442 + r1864443;
        double r1864445 = r1864441 / r1864444;
        return r1864445;
}

double f(double re, double im, double base) {
        double r1864446 = im;
        double r1864447 = re;
        double r1864448 = atan2(r1864446, r1864447);
        double r1864449 = base;
        double r1864450 = log(r1864449);
        double r1864451 = r1864448 / r1864450;
        return r1864451;
}

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 32.7

    \[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  2. Taylor expanded around 0 0.3

    \[\leadsto \color{blue}{\frac{\tan^{-1}_* \frac{im}{re}}{\log base}}\]
  3. Using strategy rm
  4. Applied clear-num0.6

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\tan^{-1}_* \frac{im}{re}}}}\]
  5. Taylor expanded around 0 0.3

    \[\leadsto \color{blue}{\frac{\tan^{-1}_* \frac{im}{re}}{\log base}}\]
  6. Final simplification0.3

    \[\leadsto \frac{\tan^{-1}_* \frac{im}{re}}{\log base}\]

Reproduce

herbie shell --seed 2019200 
(FPCore (re im base)
  :name "math.log/2 on complex, imaginary part"
  (/ (- (* (atan2 im re) (log base)) (* (log (sqrt (+ (* re re) (* im im)))) 0.0)) (+ (* (log base) (log base)) (* 0.0 0.0))))