Average Error: 31.9 → 0.4
Time: 4.8s
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 r73097 = im;
        double r73098 = re;
        double r73099 = atan2(r73097, r73098);
        double r73100 = base;
        double r73101 = log(r73100);
        double r73102 = r73099 * r73101;
        double r73103 = r73098 * r73098;
        double r73104 = r73097 * r73097;
        double r73105 = r73103 + r73104;
        double r73106 = sqrt(r73105);
        double r73107 = log(r73106);
        double r73108 = 0.0;
        double r73109 = r73107 * r73108;
        double r73110 = r73102 - r73109;
        double r73111 = r73101 * r73101;
        double r73112 = r73108 * r73108;
        double r73113 = r73111 + r73112;
        double r73114 = r73110 / r73113;
        return r73114;
}

double f(double re, double im, double base) {
        double r73115 = -1.0;
        double r73116 = im;
        double r73117 = re;
        double r73118 = atan2(r73116, r73117);
        double r73119 = base;
        double r73120 = log(r73119);
        double r73121 = r73115 / r73120;
        double r73122 = r73118 * r73121;
        double r73123 = r73115 * r73122;
        return r73123;
}

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

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