Average Error: 32.0 → 0.3
Time: 20.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}\]
\[-\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 r2084040 = im;
        double r2084041 = re;
        double r2084042 = atan2(r2084040, r2084041);
        double r2084043 = base;
        double r2084044 = log(r2084043);
        double r2084045 = r2084042 * r2084044;
        double r2084046 = r2084041 * r2084041;
        double r2084047 = r2084040 * r2084040;
        double r2084048 = r2084046 + r2084047;
        double r2084049 = sqrt(r2084048);
        double r2084050 = log(r2084049);
        double r2084051 = 0.0;
        double r2084052 = r2084050 * r2084051;
        double r2084053 = r2084045 - r2084052;
        double r2084054 = r2084044 * r2084044;
        double r2084055 = r2084051 * r2084051;
        double r2084056 = r2084054 + r2084055;
        double r2084057 = r2084053 / r2084056;
        return r2084057;
}

double f(double re, double im, double base) {
        double r2084058 = im;
        double r2084059 = re;
        double r2084060 = atan2(r2084058, r2084059);
        double r2084061 = base;
        double r2084062 = log(r2084061);
        double r2084063 = -r2084062;
        double r2084064 = r2084060 / r2084063;
        double r2084065 = -r2084064;
        return r2084065;
}

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 32.0

    \[\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. Simplified0.4

    \[\leadsto \color{blue}{\frac{\log base \cdot \tan^{-1}_* \frac{im}{re} - \log \left(\mathsf{hypot}\left(im, re\right)\right) \cdot 0.0}{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}\]
  3. Taylor expanded around 0 0.3

    \[\leadsto \color{blue}{\frac{\tan^{-1}_* \frac{im}{re}}{\log base}}\]
  4. Taylor expanded around inf 0.3

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

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

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (re im base)
  :name "math.log/2 on complex, imaginary part"
  (/ (- (* (atan2 im re) (log base)) (* (log (sqrt (+ (* re re) (* im im)))) 0.0)) (+ (* (log base) (log base)) (* 0.0 0.0))))