Average Error: 32.0 → 0.3
Time: 17.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 r87559 = im;
        double r87560 = re;
        double r87561 = atan2(r87559, r87560);
        double r87562 = base;
        double r87563 = log(r87562);
        double r87564 = r87561 * r87563;
        double r87565 = r87560 * r87560;
        double r87566 = r87559 * r87559;
        double r87567 = r87565 + r87566;
        double r87568 = sqrt(r87567);
        double r87569 = log(r87568);
        double r87570 = 0.0;
        double r87571 = r87569 * r87570;
        double r87572 = r87564 - r87571;
        double r87573 = r87563 * r87563;
        double r87574 = r87570 * r87570;
        double r87575 = r87573 + r87574;
        double r87576 = r87572 / r87575;
        return r87576;
}

double f(double re, double im, double base) {
        double r87577 = im;
        double r87578 = re;
        double r87579 = atan2(r87577, r87578);
        double r87580 = base;
        double r87581 = log(r87580);
        double r87582 = -r87581;
        double r87583 = r87579 / r87582;
        double r87584 = -r87583;
        return r87584;
}

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

    \[\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. Simplified32.0

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

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

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

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

Reproduce

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