Average Error: 44.3 → 44.3
Time: 10.4s
Precision: 64
\[\Im(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]
\[\Im(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]
\Im(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
\Im(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r13391 = xre;
        double r13392 = xim;
        double r13393 = /* ERROR: no complex support in C */;
        double r13394 = exp(r13393);
        double r13395 = -r13393;
        double r13396 = exp(r13395);
        double r13397 = r13394 + r13396;
        double r13398 = 2.0;
        double r13399 = 0.0;
        double r13400 = /* ERROR: no complex support in C */;
        double r13401 = r13397 / r13400;
        double r13402 = /* ERROR: no complex support in C */;
        return r13402;
}

double f(double xre, double xim) {
        double r13403 = xre;
        double r13404 = xim;
        double r13405 = /* ERROR: no complex support in C */;
        double r13406 = exp(r13405);
        double r13407 = -r13405;
        double r13408 = exp(r13407);
        double r13409 = r13406 + r13408;
        double r13410 = 2.0;
        double r13411 = 0.0;
        double r13412 = /* ERROR: no complex support in C */;
        double r13413 = r13409 / r13412;
        double r13414 = /* ERROR: no complex support in C */;
        return r13414;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 44.3

    \[\Im(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]
  2. Final simplification44.3

    \[\leadsto \Im(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2020034 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  :precision binary64
  (im (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2 0.0))))