Average Error: 0.0 → 0.0
Time: 4.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 r21499 = xre;
        double r21500 = xim;
        double r21501 = /* ERROR: no complex support in C */;
        double r21502 = exp(r21501);
        double r21503 = -r21501;
        double r21504 = exp(r21503);
        double r21505 = r21502 + r21504;
        double r21506 = 2.0;
        double r21507 = 0.0;
        double r21508 = /* ERROR: no complex support in C */;
        double r21509 = r21505 / r21508;
        double r21510 = /* ERROR: no complex support in C */;
        return r21510;
}

double f(double xre, double xim) {
        double r21511 = xre;
        double r21512 = xim;
        double r21513 = /* ERROR: no complex support in C */;
        double r21514 = exp(r21513);
        double r21515 = -r21513;
        double r21516 = exp(r21515);
        double r21517 = r21514 + r21516;
        double r21518 = 2.0;
        double r21519 = 0.0;
        double r21520 = /* ERROR: no complex support in C */;
        double r21521 = r21517 / r21520;
        double r21522 = /* ERROR: no complex support in C */;
        return r21522;
}

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