Average Error: 30.9 → 0.3
Time: 13.0s
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 \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{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 \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}
double f(double re, double im, double base) {
        double r31522 = im;
        double r31523 = re;
        double r31524 = atan2(r31522, r31523);
        double r31525 = base;
        double r31526 = log(r31525);
        double r31527 = r31524 * r31526;
        double r31528 = r31523 * r31523;
        double r31529 = r31522 * r31522;
        double r31530 = r31528 + r31529;
        double r31531 = sqrt(r31530);
        double r31532 = log(r31531);
        double r31533 = 0.0;
        double r31534 = r31532 * r31533;
        double r31535 = r31527 - r31534;
        double r31536 = r31526 * r31526;
        double r31537 = r31533 * r31533;
        double r31538 = r31536 + r31537;
        double r31539 = r31535 / r31538;
        return r31539;
}

double f(double re, double im, double base) {
        double r31540 = -1.0;
        double r31541 = im;
        double r31542 = re;
        double r31543 = atan2(r31541, r31542);
        double r31544 = 1.0;
        double r31545 = base;
        double r31546 = r31544 / r31545;
        double r31547 = log(r31546);
        double r31548 = r31543 / r31547;
        double r31549 = r31540 * r31548;
        return r31549;
}

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 30.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. Using strategy rm
  6. Applied un-div-inv0.3

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

    \[\leadsto -1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\log \left(\frac{1}{base}\right)}\]

Reproduce

herbie shell --seed 2019303 
(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))))