Average Error: 32.0 → 0.3
Time: 16.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}\]
\[-\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 r3407988 = im;
        double r3407989 = re;
        double r3407990 = atan2(r3407988, r3407989);
        double r3407991 = base;
        double r3407992 = log(r3407991);
        double r3407993 = r3407990 * r3407992;
        double r3407994 = r3407989 * r3407989;
        double r3407995 = r3407988 * r3407988;
        double r3407996 = r3407994 + r3407995;
        double r3407997 = sqrt(r3407996);
        double r3407998 = log(r3407997);
        double r3407999 = 0.0;
        double r3408000 = r3407998 * r3407999;
        double r3408001 = r3407993 - r3408000;
        double r3408002 = r3407992 * r3407992;
        double r3408003 = r3407999 * r3407999;
        double r3408004 = r3408002 + r3408003;
        double r3408005 = r3408001 / r3408004;
        return r3408005;
}

double f(double re, double im, double base) {
        double r3408006 = im;
        double r3408007 = re;
        double r3408008 = atan2(r3408006, r3408007);
        double r3408009 = base;
        double r3408010 = log(r3408009);
        double r3408011 = -r3408010;
        double r3408012 = r3408008 / r3408011;
        double r3408013 = -r3408012;
        return r3408013;
}

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{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\mathsf{hypot}\left(re, im\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))))