Average Error: 31.7 → 0.3
Time: 4.1s
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 r27246 = im;
        double r27247 = re;
        double r27248 = atan2(r27246, r27247);
        double r27249 = base;
        double r27250 = log(r27249);
        double r27251 = r27248 * r27250;
        double r27252 = r27247 * r27247;
        double r27253 = r27246 * r27246;
        double r27254 = r27252 + r27253;
        double r27255 = sqrt(r27254);
        double r27256 = log(r27255);
        double r27257 = 0.0;
        double r27258 = r27256 * r27257;
        double r27259 = r27251 - r27258;
        double r27260 = r27250 * r27250;
        double r27261 = r27257 * r27257;
        double r27262 = r27260 + r27261;
        double r27263 = r27259 / r27262;
        return r27263;
}

double f(double re, double im, double base) {
        double r27264 = -1.0;
        double r27265 = im;
        double r27266 = re;
        double r27267 = atan2(r27265, r27266);
        double r27268 = 1.0;
        double r27269 = base;
        double r27270 = r27268 / r27269;
        double r27271 = log(r27270);
        double r27272 = r27267 / r27271;
        double r27273 = r27264 * r27272;
        return r27273;
}

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

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