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 r12301 = xre;
        double r12302 = xim;
        double r12303 = /* ERROR: no complex support in C */;
        double r12304 = exp(r12303);
        double r12305 = -r12303;
        double r12306 = exp(r12305);
        double r12307 = r12304 + r12306;
        double r12308 = 2.0;
        double r12309 = 0.0;
        double r12310 = /* ERROR: no complex support in C */;
        double r12311 = r12307 / r12310;
        double r12312 = /* ERROR: no complex support in C */;
        return r12312;
}

double f(double xre, double xim) {
        double r12313 = xre;
        double r12314 = xim;
        double r12315 = /* ERROR: no complex support in C */;
        double r12316 = exp(r12315);
        double r12317 = -r12315;
        double r12318 = exp(r12317);
        double r12319 = r12316 + r12318;
        double r12320 = 2.0;
        double r12321 = 0.0;
        double r12322 = /* ERROR: no complex support in C */;
        double r12323 = r12319 / r12322;
        double r12324 = /* ERROR: no complex support in C */;
        return r12324;
}

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