Average Error: 31.6 → 0.3
Time: 24.0s
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 r30956 = im;
        double r30957 = re;
        double r30958 = atan2(r30956, r30957);
        double r30959 = base;
        double r30960 = log(r30959);
        double r30961 = r30958 * r30960;
        double r30962 = r30957 * r30957;
        double r30963 = r30956 * r30956;
        double r30964 = r30962 + r30963;
        double r30965 = sqrt(r30964);
        double r30966 = log(r30965);
        double r30967 = 0.0;
        double r30968 = r30966 * r30967;
        double r30969 = r30961 - r30968;
        double r30970 = r30960 * r30960;
        double r30971 = r30967 * r30967;
        double r30972 = r30970 + r30971;
        double r30973 = r30969 / r30972;
        return r30973;
}

double f(double re, double im, double base) {
        double r30974 = im;
        double r30975 = re;
        double r30976 = atan2(r30974, r30975);
        double r30977 = base;
        double r30978 = log(r30977);
        double r30979 = -r30978;
        double r30980 = r30976 / r30979;
        double r30981 = -r30980;
        return r30981;
}

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

    \[\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.6

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