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 r20283 = xre;
        double r20284 = xim;
        double r20285 = /* ERROR: no complex support in C */;
        double r20286 = exp(r20285);
        double r20287 = -r20285;
        double r20288 = exp(r20287);
        double r20289 = r20286 + r20288;
        double r20290 = 2.0;
        double r20291 = 0.0;
        double r20292 = /* ERROR: no complex support in C */;
        double r20293 = r20289 / r20292;
        double r20294 = /* ERROR: no complex support in C */;
        return r20294;
}

double f(double xre, double xim) {
        double r20295 = xre;
        double r20296 = xim;
        double r20297 = /* ERROR: no complex support in C */;
        double r20298 = exp(r20297);
        double r20299 = -r20297;
        double r20300 = exp(r20299);
        double r20301 = r20298 + r20300;
        double r20302 = 2.0;
        double r20303 = 0.0;
        double r20304 = /* ERROR: no complex support in C */;
        double r20305 = r20301 / r20304;
        double r20306 = /* ERROR: no complex support in C */;
        return r20306;
}

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