Average Error: 31.4 → 0.4
Time: 20.6s
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{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)\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{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)\right)\right)
double f(double re, double im, double base) {
        double r2186267 = im;
        double r2186268 = re;
        double r2186269 = atan2(r2186267, r2186268);
        double r2186270 = base;
        double r2186271 = log(r2186270);
        double r2186272 = r2186269 * r2186271;
        double r2186273 = r2186268 * r2186268;
        double r2186274 = r2186267 * r2186267;
        double r2186275 = r2186273 + r2186274;
        double r2186276 = sqrt(r2186275);
        double r2186277 = log(r2186276);
        double r2186278 = 0.0;
        double r2186279 = r2186277 * r2186278;
        double r2186280 = r2186272 - r2186279;
        double r2186281 = r2186271 * r2186271;
        double r2186282 = r2186278 * r2186278;
        double r2186283 = r2186281 + r2186282;
        double r2186284 = r2186280 / r2186283;
        return r2186284;
}

double f(double re, double im, double base) {
        double r2186285 = im;
        double r2186286 = re;
        double r2186287 = atan2(r2186285, r2186286);
        double r2186288 = base;
        double r2186289 = log(r2186288);
        double r2186290 = r2186287 / r2186289;
        double r2186291 = log1p(r2186290);
        double r2186292 = log1p(r2186291);
        double r2186293 = expm1(r2186292);
        double r2186294 = expm1(r2186293);
        return r2186294;
}

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

    \[\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 expm1-log1p-u0.4

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan^{-1}_* \frac{im}{re}}{\log base}\right)\right)}\]
  5. Using strategy rm
  6. Applied expm1-log1p-u0.4

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

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

Reproduce

herbie shell --seed 2019164 +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))))