Average Error: 32.3 → 0.3
Time: 4.5s
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 r28205 = im;
        double r28206 = re;
        double r28207 = atan2(r28205, r28206);
        double r28208 = base;
        double r28209 = log(r28208);
        double r28210 = r28207 * r28209;
        double r28211 = r28206 * r28206;
        double r28212 = r28205 * r28205;
        double r28213 = r28211 + r28212;
        double r28214 = sqrt(r28213);
        double r28215 = log(r28214);
        double r28216 = 0.0;
        double r28217 = r28215 * r28216;
        double r28218 = r28210 - r28217;
        double r28219 = r28209 * r28209;
        double r28220 = r28216 * r28216;
        double r28221 = r28219 + r28220;
        double r28222 = r28218 / r28221;
        return r28222;
}

double f(double re, double im, double base) {
        double r28223 = -1.0;
        double r28224 = im;
        double r28225 = re;
        double r28226 = atan2(r28224, r28225);
        double r28227 = 1.0;
        double r28228 = base;
        double r28229 = r28227 / r28228;
        double r28230 = log(r28229);
        double r28231 = r28226 / r28230;
        double r28232 = r28223 * r28231;
        return r28232;
}

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

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