Average Error: 0.0 → 0.0
Time: 3.6s
Precision: 64
\[\Re(\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))\]
\[\Re(\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))\]
\Re(\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))
\Re(\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 r22602 = xre;
        double r22603 = xim;
        double r22604 = /* ERROR: no complex support in C */;
        double r22605 = exp(r22604);
        double r22606 = -r22604;
        double r22607 = exp(r22606);
        double r22608 = r22605 + r22607;
        double r22609 = 2.0;
        double r22610 = 0.0;
        double r22611 = /* ERROR: no complex support in C */;
        double r22612 = r22608 / r22611;
        double r22613 = /* ERROR: no complex support in C */;
        return r22613;
}

double f(double xre, double xim) {
        double r22614 = xre;
        double r22615 = xim;
        double r22616 = /* ERROR: no complex support in C */;
        double r22617 = exp(r22616);
        double r22618 = -r22616;
        double r22619 = exp(r22618);
        double r22620 = r22617 + r22619;
        double r22621 = 2.0;
        double r22622 = 0.0;
        double r22623 = /* ERROR: no complex support in C */;
        double r22624 = r22620 / r22623;
        double r22625 = /* ERROR: no complex support in C */;
        return r22625;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 0.0

    \[\Re(\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 simplification0.0

    \[\leadsto \Re(\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 2020045 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  :precision binary64
  (re (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2 0.0))))