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 r15242 = xre;
        double r15243 = xim;
        double r15244 = /* ERROR: no complex support in C */;
        double r15245 = exp(r15244);
        double r15246 = -r15244;
        double r15247 = exp(r15246);
        double r15248 = r15245 + r15247;
        double r15249 = 2.0;
        double r15250 = 0.0;
        double r15251 = /* ERROR: no complex support in C */;
        double r15252 = r15248 / r15251;
        double r15253 = /* ERROR: no complex support in C */;
        return r15253;
}

double f(double xre, double xim) {
        double r15254 = xre;
        double r15255 = xim;
        double r15256 = /* ERROR: no complex support in C */;
        double r15257 = exp(r15256);
        double r15258 = -r15256;
        double r15259 = exp(r15258);
        double r15260 = r15257 + r15259;
        double r15261 = 2.0;
        double r15262 = 0.0;
        double r15263 = /* ERROR: no complex support in C */;
        double r15264 = r15260 / r15263;
        double r15265 = /* ERROR: no complex support in C */;
        return r15265;
}

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