Average Error: 30.7 → 0.3
Time: 24.3s
Precision: 64
\[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)\]
\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0}{\log base \cdot \log base + 0 \cdot 0}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)
double f(double re, double im, double base) {
        double r1800666 = im;
        double r1800667 = re;
        double r1800668 = atan2(r1800666, r1800667);
        double r1800669 = base;
        double r1800670 = log(r1800669);
        double r1800671 = r1800668 * r1800670;
        double r1800672 = r1800667 * r1800667;
        double r1800673 = r1800666 * r1800666;
        double r1800674 = r1800672 + r1800673;
        double r1800675 = sqrt(r1800674);
        double r1800676 = log(r1800675);
        double r1800677 = 0.0;
        double r1800678 = r1800676 * r1800677;
        double r1800679 = r1800671 - r1800678;
        double r1800680 = r1800670 * r1800670;
        double r1800681 = r1800677 * r1800677;
        double r1800682 = r1800680 + r1800681;
        double r1800683 = r1800679 / r1800682;
        return r1800683;
}

double f(double re, double im, double base) {
        double r1800684 = im;
        double r1800685 = re;
        double r1800686 = atan2(r1800684, r1800685);
        double r1800687 = base;
        double r1800688 = log(r1800687);
        double r1800689 = r1800686 / r1800688;
        double r1800690 = expm1(r1800689);
        double r1800691 = log1p(r1800690);
        return r1800691;
}

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

    \[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
  2. Simplified0.3

    \[\leadsto \color{blue}{\frac{\tan^{-1}_* \frac{im}{re}}{\log base}}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u0.3

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

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

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (re im base)
  :name "math.log/2 on complex, imaginary part"
  (/ (- (* (atan2 im re) (log base)) (* (log (sqrt (+ (* re re) (* im im)))) 0)) (+ (* (log base) (log base)) (* 0 0))))