Average Error: 32.3 → 0.4
Time: 4.7s
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 r31533 = im;
        double r31534 = re;
        double r31535 = atan2(r31533, r31534);
        double r31536 = base;
        double r31537 = log(r31536);
        double r31538 = r31535 * r31537;
        double r31539 = r31534 * r31534;
        double r31540 = r31533 * r31533;
        double r31541 = r31539 + r31540;
        double r31542 = sqrt(r31541);
        double r31543 = log(r31542);
        double r31544 = 0.0;
        double r31545 = r31543 * r31544;
        double r31546 = r31538 - r31545;
        double r31547 = r31537 * r31537;
        double r31548 = r31544 * r31544;
        double r31549 = r31547 + r31548;
        double r31550 = r31546 / r31549;
        return r31550;
}

double f(double re, double im, double base) {
        double r31551 = -1.0;
        double r31552 = im;
        double r31553 = re;
        double r31554 = atan2(r31552, r31553);
        double r31555 = base;
        double r31556 = log(r31555);
        double r31557 = r31551 / r31556;
        double r31558 = r31554 * r31557;
        double r31559 = r31551 * r31558;
        return r31559;
}

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

    \[\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 2020059 +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))))