Average Error: 31.5 → 0.3
Time: 3.9s
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}\]
\[\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\]
\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}
\frac{\tan^{-1}_* \frac{im}{re}}{\log base}
double f(double re, double im, double base) {
        double r27699 = im;
        double r27700 = re;
        double r27701 = atan2(r27699, r27700);
        double r27702 = base;
        double r27703 = log(r27702);
        double r27704 = r27701 * r27703;
        double r27705 = r27700 * r27700;
        double r27706 = r27699 * r27699;
        double r27707 = r27705 + r27706;
        double r27708 = sqrt(r27707);
        double r27709 = log(r27708);
        double r27710 = 0.0;
        double r27711 = r27709 * r27710;
        double r27712 = r27704 - r27711;
        double r27713 = r27703 * r27703;
        double r27714 = r27710 * r27710;
        double r27715 = r27713 + r27714;
        double r27716 = r27712 / r27715;
        return r27716;
}

double f(double re, double im, double base) {
        double r27717 = im;
        double r27718 = re;
        double r27719 = atan2(r27717, r27718);
        double r27720 = base;
        double r27721 = log(r27720);
        double r27722 = r27719 / r27721;
        return r27722;
}

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. 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. Using strategy rm
  7. Applied *-un-lft-identity0.4

    \[\leadsto -1 \cdot \left(\color{blue}{\left(1 \cdot \tan^{-1}_* \frac{im}{re}\right)} \cdot \frac{-1}{\log base}\right)\]
  8. Applied associate-*l*0.4

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

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

    \[\leadsto \frac{\tan^{-1}_* \frac{im}{re}}{\log base}\]

Reproduce

herbie shell --seed 2020036 +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))))