Average Error: 31.6 → 0.3
Time: 19.6s
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 r63537 = im;
        double r63538 = re;
        double r63539 = atan2(r63537, r63538);
        double r63540 = base;
        double r63541 = log(r63540);
        double r63542 = r63539 * r63541;
        double r63543 = r63538 * r63538;
        double r63544 = r63537 * r63537;
        double r63545 = r63543 + r63544;
        double r63546 = sqrt(r63545);
        double r63547 = log(r63546);
        double r63548 = 0.0;
        double r63549 = r63547 * r63548;
        double r63550 = r63542 - r63549;
        double r63551 = r63541 * r63541;
        double r63552 = r63548 * r63548;
        double r63553 = r63551 + r63552;
        double r63554 = r63550 / r63553;
        return r63554;
}

double f(double re, double im, double base) {
        double r63555 = im;
        double r63556 = re;
        double r63557 = atan2(r63555, r63556);
        double r63558 = base;
        double r63559 = log(r63558);
        double r63560 = -r63559;
        double r63561 = r63557 / r63560;
        double r63562 = -r63561;
        return r63562;
}

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

    \[\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{\mathsf{fma}\left(\tan^{-1}_* \frac{im}{re}, \log base, -0.0 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)}{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}\]
  3. Taylor expanded around inf 0.3

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

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

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

Reproduce

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