Average Error: 32.1 → 0.3
Time: 37.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}\]
\[-\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 r44510 = im;
        double r44511 = re;
        double r44512 = atan2(r44510, r44511);
        double r44513 = base;
        double r44514 = log(r44513);
        double r44515 = r44512 * r44514;
        double r44516 = r44511 * r44511;
        double r44517 = r44510 * r44510;
        double r44518 = r44516 + r44517;
        double r44519 = sqrt(r44518);
        double r44520 = log(r44519);
        double r44521 = 0.0;
        double r44522 = r44520 * r44521;
        double r44523 = r44515 - r44522;
        double r44524 = r44514 * r44514;
        double r44525 = r44521 * r44521;
        double r44526 = r44524 + r44525;
        double r44527 = r44523 / r44526;
        return r44527;
}

double f(double re, double im, double base) {
        double r44528 = im;
        double r44529 = re;
        double r44530 = atan2(r44528, r44529);
        double r44531 = base;
        double r44532 = log(r44531);
        double r44533 = -r44532;
        double r44534 = r44530 / r44533;
        double r44535 = -r44534;
        return r44535;
}

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

    \[\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. Simplified0.3

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

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

Reproduce

herbie shell --seed 2019199 
(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))))