Average Error: 31.5 → 0.3
Time: 5.6s
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 r78370 = im;
        double r78371 = re;
        double r78372 = atan2(r78370, r78371);
        double r78373 = base;
        double r78374 = log(r78373);
        double r78375 = r78372 * r78374;
        double r78376 = r78371 * r78371;
        double r78377 = r78370 * r78370;
        double r78378 = r78376 + r78377;
        double r78379 = sqrt(r78378);
        double r78380 = log(r78379);
        double r78381 = 0.0;
        double r78382 = r78380 * r78381;
        double r78383 = r78375 - r78382;
        double r78384 = r78374 * r78374;
        double r78385 = r78381 * r78381;
        double r78386 = r78384 + r78385;
        double r78387 = r78383 / r78386;
        return r78387;
}

double f(double re, double im, double base) {
        double r78388 = -1.0;
        double r78389 = im;
        double r78390 = re;
        double r78391 = atan2(r78389, r78390);
        double r78392 = 1.0;
        double r78393 = base;
        double r78394 = r78392 / r78393;
        double r78395 = log(r78394);
        double r78396 = r78391 / r78395;
        double r78397 = r78388 * r78396;
        return r78397;
}

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

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