Average Error: 31.9 → 0.4
Time: 4.9s
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 r24736 = im;
        double r24737 = re;
        double r24738 = atan2(r24736, r24737);
        double r24739 = base;
        double r24740 = log(r24739);
        double r24741 = r24738 * r24740;
        double r24742 = r24737 * r24737;
        double r24743 = r24736 * r24736;
        double r24744 = r24742 + r24743;
        double r24745 = sqrt(r24744);
        double r24746 = log(r24745);
        double r24747 = 0.0;
        double r24748 = r24746 * r24747;
        double r24749 = r24741 - r24748;
        double r24750 = r24740 * r24740;
        double r24751 = r24747 * r24747;
        double r24752 = r24750 + r24751;
        double r24753 = r24749 / r24752;
        return r24753;
}

double f(double re, double im, double base) {
        double r24754 = -1.0;
        double r24755 = im;
        double r24756 = re;
        double r24757 = atan2(r24755, r24756);
        double r24758 = base;
        double r24759 = log(r24758);
        double r24760 = r24754 / r24759;
        double r24761 = r24757 * r24760;
        double r24762 = r24754 * r24761;
        return r24762;
}

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 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 2019353 +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))))