Average Error: 31.8 → 0.3
Time: 11.3s
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 r90235 = im;
        double r90236 = re;
        double r90237 = atan2(r90235, r90236);
        double r90238 = base;
        double r90239 = log(r90238);
        double r90240 = r90237 * r90239;
        double r90241 = r90236 * r90236;
        double r90242 = r90235 * r90235;
        double r90243 = r90241 + r90242;
        double r90244 = sqrt(r90243);
        double r90245 = log(r90244);
        double r90246 = 0.0;
        double r90247 = r90245 * r90246;
        double r90248 = r90240 - r90247;
        double r90249 = r90239 * r90239;
        double r90250 = r90246 * r90246;
        double r90251 = r90249 + r90250;
        double r90252 = r90248 / r90251;
        return r90252;
}

double f(double re, double im, double base) {
        double r90253 = -1.0;
        double r90254 = im;
        double r90255 = re;
        double r90256 = atan2(r90254, r90255);
        double r90257 = 1.0;
        double r90258 = base;
        double r90259 = r90257 / r90258;
        double r90260 = log(r90259);
        double r90261 = r90256 / r90260;
        double r90262 = r90253 * r90261;
        return r90262;
}

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

    \[\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 clear-num0.5

    \[\leadsto -1 \cdot \color{blue}{\frac{1}{\frac{\log \left(\frac{1}{base}\right)}{\tan^{-1}_* \frac{im}{re}}}}\]
  5. Taylor expanded around inf 0.3

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

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

Reproduce

herbie shell --seed 2019297 
(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))))