Average Error: 31.9 → 0.4
Time: 5.2s
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 \left(\frac{1}{base}\right)}\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 \left(\frac{1}{base}\right)}\right)
double f(double re, double im, double base) {
        double r34596 = im;
        double r34597 = re;
        double r34598 = atan2(r34596, r34597);
        double r34599 = base;
        double r34600 = log(r34599);
        double r34601 = r34598 * r34600;
        double r34602 = r34597 * r34597;
        double r34603 = r34596 * r34596;
        double r34604 = r34602 + r34603;
        double r34605 = sqrt(r34604);
        double r34606 = log(r34605);
        double r34607 = 0.0;
        double r34608 = r34606 * r34607;
        double r34609 = r34601 - r34608;
        double r34610 = r34600 * r34600;
        double r34611 = r34607 * r34607;
        double r34612 = r34610 + r34611;
        double r34613 = r34609 / r34612;
        return r34613;
}

double f(double re, double im, double base) {
        double r34614 = -1.0;
        double r34615 = im;
        double r34616 = re;
        double r34617 = atan2(r34615, r34616);
        double r34618 = 1.0;
        double r34619 = base;
        double r34620 = r34618 / r34619;
        double r34621 = log(r34620);
        double r34622 = r34618 / r34621;
        double r34623 = r34617 * r34622;
        double r34624 = r34614 * r34623;
        return r34624;
}

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.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 add-cbrt-cube0.6

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

    \[\leadsto -1 \cdot \frac{\tan^{-1}_* \frac{im}{re}}{\sqrt[3]{\color{blue}{{\left(\log \left(\frac{1}{base}\right)\right)}^{3}}}}\]
  6. Using strategy rm
  7. Applied div-inv0.6

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

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

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

Reproduce

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