Average Error: 0.0 → 0.0
Time: 3.9s
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 r22274 = xre;
        double r22275 = xim;
        double r22276 = /* ERROR: no complex support in C */;
        double r22277 = exp(r22276);
        double r22278 = -r22276;
        double r22279 = exp(r22278);
        double r22280 = r22277 + r22279;
        double r22281 = 2.0;
        double r22282 = 0.0;
        double r22283 = /* ERROR: no complex support in C */;
        double r22284 = r22280 / r22283;
        double r22285 = /* ERROR: no complex support in C */;
        return r22285;
}

double f(double xre, double xim) {
        double r22286 = xre;
        double r22287 = xim;
        double r22288 = /* ERROR: no complex support in C */;
        double r22289 = exp(r22288);
        double r22290 = -r22288;
        double r22291 = exp(r22290);
        double r22292 = r22289 + r22291;
        double r22293 = 2.0;
        double r22294 = 0.0;
        double r22295 = /* ERROR: no complex support in C */;
        double r22296 = r22292 / r22295;
        double r22297 = /* ERROR: no complex support in C */;
        return r22297;
}

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