Average Error: 43.1 → 43.1
Time: 26.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 r10565 = xre;
        double r10566 = xim;
        double r10567 = /* ERROR: no complex support in C */;
        double r10568 = exp(r10567);
        double r10569 = -r10567;
        double r10570 = exp(r10569);
        double r10571 = r10568 + r10570;
        double r10572 = 2.0;
        double r10573 = 0.0;
        double r10574 = /* ERROR: no complex support in C */;
        double r10575 = r10571 / r10574;
        double r10576 = /* ERROR: no complex support in C */;
        return r10576;
}

double f(double xre, double xim) {
        double r10577 = xre;
        double r10578 = xim;
        double r10579 = /* ERROR: no complex support in C */;
        double r10580 = -r10579;
        double r10581 = exp(r10580);
        double r10582 = exp(r10579);
        double r10583 = r10581 + r10582;
        double r10584 = 2.0;
        double r10585 = 0.0;
        double r10586 = /* ERROR: no complex support in C */;
        double r10587 = r10583 / r10586;
        double r10588 = /* ERROR: no complex support in C */;
        return r10588;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.1

    \[\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.1

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

Reproduce

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