Average Error: 31.7 → 0.3
Time: 4.3s
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}\]
\[-1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}\]
\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}
-1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}
double f(double re, double im, double base) {
        double r36424 = im;
        double r36425 = re;
        double r36426 = atan2(r36424, r36425);
        double r36427 = base;
        double r36428 = log(r36427);
        double r36429 = r36426 * r36428;
        double r36430 = r36425 * r36425;
        double r36431 = r36424 * r36424;
        double r36432 = r36430 + r36431;
        double r36433 = sqrt(r36432);
        double r36434 = log(r36433);
        double r36435 = 0.0;
        double r36436 = r36434 * r36435;
        double r36437 = r36429 - r36436;
        double r36438 = r36428 * r36428;
        double r36439 = r36435 * r36435;
        double r36440 = r36438 + r36439;
        double r36441 = r36437 / r36440;
        return r36441;
}

double f(double re, double im, double base) {
        double r36442 = -1.0;
        double r36443 = im;
        double r36444 = re;
        double r36445 = atan2(r36443, r36444);
        double r36446 = 1.0;
        double r36447 = base;
        double r36448 = r36446 / r36447;
        double r36449 = log(r36448);
        double r36450 = r36445 / r36449;
        double r36451 = r36442 * r36450;
        return r36451;
}

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.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 inf 0.3

    \[\leadsto \color{blue}{-1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}}\]
  3. Final simplification0.3

    \[\leadsto -1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}\]

Reproduce

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