Average Error: 31.7 → 0.4
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 \left(\tan^{-1}_* \frac{im}{re} \cdot \frac{-1}{\log 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 \left(\tan^{-1}_* \frac{im}{re} \cdot \frac{-1}{\log base}\right)
double f(double re, double im, double base) {
        double r42048 = im;
        double r42049 = re;
        double r42050 = atan2(r42048, r42049);
        double r42051 = base;
        double r42052 = log(r42051);
        double r42053 = r42050 * r42052;
        double r42054 = r42049 * r42049;
        double r42055 = r42048 * r42048;
        double r42056 = r42054 + r42055;
        double r42057 = sqrt(r42056);
        double r42058 = log(r42057);
        double r42059 = 0.0;
        double r42060 = r42058 * r42059;
        double r42061 = r42053 - r42060;
        double r42062 = r42052 * r42052;
        double r42063 = r42059 * r42059;
        double r42064 = r42062 + r42063;
        double r42065 = r42061 / r42064;
        return r42065;
}

double f(double re, double im, double base) {
        double r42066 = -1.0;
        double r42067 = im;
        double r42068 = re;
        double r42069 = atan2(r42067, r42068);
        double r42070 = base;
        double r42071 = log(r42070);
        double r42072 = r42066 / r42071;
        double r42073 = r42069 * r42072;
        double r42074 = r42066 * r42073;
        return r42074;
}

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. Using strategy rm
  4. Applied div-inv0.4

    \[\leadsto -1 \cdot \color{blue}{\left(\tan^{-1}_* \frac{im}{re} \cdot \frac{1}{\log \left(\frac{1}{base}\right)}\right)}\]
  5. Simplified0.4

    \[\leadsto -1 \cdot \left(\tan^{-1}_* \frac{im}{re} \cdot \color{blue}{\frac{-1}{\log base}}\right)\]
  6. Final simplification0.4

    \[\leadsto -1 \cdot \left(\tan^{-1}_* \frac{im}{re} \cdot \frac{-1}{\log base}\right)\]

Reproduce

herbie shell --seed 2020056 +o rules:numerics
(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))))