Average Error: 42.9 → 42.9
Time: 10.5s
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 r21602 = xre;
        double r21603 = xim;
        double r21604 = /* ERROR: no complex support in C */;
        double r21605 = exp(r21604);
        double r21606 = -r21604;
        double r21607 = exp(r21606);
        double r21608 = r21605 + r21607;
        double r21609 = 2.0;
        double r21610 = 0.0;
        double r21611 = /* ERROR: no complex support in C */;
        double r21612 = r21608 / r21611;
        double r21613 = /* ERROR: no complex support in C */;
        return r21613;
}

double f(double xre, double xim) {
        double r21614 = xre;
        double r21615 = xim;
        double r21616 = /* ERROR: no complex support in C */;
        double r21617 = exp(r21616);
        double r21618 = -r21616;
        double r21619 = exp(r21618);
        double r21620 = r21617 + r21619;
        double r21621 = 2.0;
        double r21622 = 0.0;
        double r21623 = /* ERROR: no complex support in C */;
        double r21624 = r21620 / r21623;
        double r21625 = /* ERROR: no complex support in C */;
        return r21625;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 42.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 simplification42.9

    \[\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 2020047 +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))))