Average Error: 30.7 → 0.3
Time: 23.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 r2437096 = im;
        double r2437097 = re;
        double r2437098 = atan2(r2437096, r2437097);
        double r2437099 = base;
        double r2437100 = log(r2437099);
        double r2437101 = r2437098 * r2437100;
        double r2437102 = r2437097 * r2437097;
        double r2437103 = r2437096 * r2437096;
        double r2437104 = r2437102 + r2437103;
        double r2437105 = sqrt(r2437104);
        double r2437106 = log(r2437105);
        double r2437107 = 0.0;
        double r2437108 = r2437106 * r2437107;
        double r2437109 = r2437101 - r2437108;
        double r2437110 = r2437100 * r2437100;
        double r2437111 = r2437107 * r2437107;
        double r2437112 = r2437110 + r2437111;
        double r2437113 = r2437109 / r2437112;
        return r2437113;
}

double f(double re, double im, double base) {
        double r2437114 = im;
        double r2437115 = re;
        double r2437116 = atan2(r2437114, r2437115);
        double r2437117 = base;
        double r2437118 = log(r2437117);
        double r2437119 = r2437116 / r2437118;
        double r2437120 = expm1(r2437119);
        double r2437121 = log1p(r2437120);
        return r2437121;
}

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