Average Error: 43.9 → 43.9
Time: 28.2s
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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r10612 = xre;
        double r10613 = xim;
        double r10614 = /* ERROR: no complex support in C */;
        double r10615 = exp(r10614);
        double r10616 = -r10614;
        double r10617 = exp(r10616);
        double r10618 = r10615 + r10617;
        double r10619 = 2.0;
        double r10620 = 0.0;
        double r10621 = /* ERROR: no complex support in C */;
        double r10622 = r10618 / r10621;
        double r10623 = /* ERROR: no complex support in C */;
        return r10623;
}

double f(double xre, double xim) {
        double r10624 = xre;
        double r10625 = xim;
        double r10626 = /* ERROR: no complex support in C */;
        double r10627 = -r10626;
        double r10628 = exp(r10627);
        double r10629 = exp(r10626);
        double r10630 = r10628 + r10629;
        double r10631 = 2.0;
        double r10632 = 0.0;
        double r10633 = /* ERROR: no complex support in C */;
        double r10634 = r10630 / r10633;
        double r10635 = /* ERROR: no complex support in C */;
        return r10635;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.9

    \[\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 simplification43.9

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

Reproduce

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