Average Error: 0.0 → 0.0
Time: 3.8s
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 r22464 = xre;
        double r22465 = xim;
        double r22466 = /* ERROR: no complex support in C */;
        double r22467 = exp(r22466);
        double r22468 = -r22466;
        double r22469 = exp(r22468);
        double r22470 = r22467 + r22469;
        double r22471 = 2.0;
        double r22472 = 0.0;
        double r22473 = /* ERROR: no complex support in C */;
        double r22474 = r22470 / r22473;
        double r22475 = /* ERROR: no complex support in C */;
        return r22475;
}

double f(double xre, double xim) {
        double r22476 = xre;
        double r22477 = xim;
        double r22478 = /* ERROR: no complex support in C */;
        double r22479 = exp(r22478);
        double r22480 = -r22478;
        double r22481 = exp(r22480);
        double r22482 = r22479 + r22481;
        double r22483 = 2.0;
        double r22484 = 0.0;
        double r22485 = /* ERROR: no complex support in C */;
        double r22486 = r22482 / r22485;
        double r22487 = /* ERROR: no complex support in C */;
        return r22487;
}

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 2020033 +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))))