Average Error: 31.9 → 0.3
Time: 19.9s
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 r26740 = im;
        double r26741 = re;
        double r26742 = atan2(r26740, r26741);
        double r26743 = base;
        double r26744 = log(r26743);
        double r26745 = r26742 * r26744;
        double r26746 = r26741 * r26741;
        double r26747 = r26740 * r26740;
        double r26748 = r26746 + r26747;
        double r26749 = sqrt(r26748);
        double r26750 = log(r26749);
        double r26751 = 0.0;
        double r26752 = r26750 * r26751;
        double r26753 = r26745 - r26752;
        double r26754 = r26744 * r26744;
        double r26755 = r26751 * r26751;
        double r26756 = r26754 + r26755;
        double r26757 = r26753 / r26756;
        return r26757;
}

double f(double re, double im, double base) {
        double r26758 = im;
        double r26759 = re;
        double r26760 = atan2(r26758, r26759);
        double r26761 = base;
        double r26762 = log(r26761);
        double r26763 = -r26762;
        double r26764 = r26760 / r26763;
        double r26765 = -r26764;
        return r26765;
}

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

    \[\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. Simplified31.9

    \[\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 2019194 
(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))))