Average Error: 43.6 → 43.6
Time: 27.9s
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 i\right)}\right))\]
\[\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\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 i\right)}\right))
\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))
double f(double xre, double xim) {
        double r10526 = xre;
        double r10527 = xim;
        double r10528 = /* ERROR: no complex support in C */;
        double r10529 = exp(r10528);
        double r10530 = -r10528;
        double r10531 = exp(r10530);
        double r10532 = r10529 + r10531;
        double r10533 = 2.0;
        double r10534 = 0.0;
        double r10535 = /* ERROR: no complex support in C */;
        double r10536 = r10532 / r10535;
        double r10537 = /* ERROR: no complex support in C */;
        return r10537;
}

double f(double xre, double xim) {
        double r10538 = xre;
        double r10539 = xim;
        double r10540 = /* ERROR: no complex support in C */;
        double r10541 = -r10540;
        double r10542 = exp(r10541);
        double r10543 = exp(r10540);
        double r10544 = r10542 + r10543;
        double r10545 = 2.0;
        double r10546 = 0.0;
        double r10547 = /* ERROR: no complex support in C */;
        double r10548 = r10544 / r10547;
        double r10549 = /* ERROR: no complex support in C */;
        return r10549;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.6

    \[\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 i\right)}\right))\]
  2. Final simplification43.6

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

Reproduce

herbie shell --seed 2019143 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  (im (/.c (+.c (exp.c (complex xre xim)) (exp.c (neg.c (complex xre xim)))) (complex 2 0))))