Average Error: 0.0 → 0.0
Time: 4.0s
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 r12437 = xre;
        double r12438 = xim;
        double r12439 = /* ERROR: no complex support in C */;
        double r12440 = exp(r12439);
        double r12441 = -r12439;
        double r12442 = exp(r12441);
        double r12443 = r12440 + r12442;
        double r12444 = 2.0;
        double r12445 = 0.0;
        double r12446 = /* ERROR: no complex support in C */;
        double r12447 = r12443 / r12446;
        double r12448 = /* ERROR: no complex support in C */;
        return r12448;
}

double f(double xre, double xim) {
        double r12449 = xre;
        double r12450 = xim;
        double r12451 = /* ERROR: no complex support in C */;
        double r12452 = exp(r12451);
        double r12453 = -r12451;
        double r12454 = exp(r12453);
        double r12455 = r12452 + r12454;
        double r12456 = 2.0;
        double r12457 = 0.0;
        double r12458 = /* ERROR: no complex support in C */;
        double r12459 = r12455 / r12458;
        double r12460 = /* ERROR: no complex support in C */;
        return r12460;
}

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