Average Error: 0.0 → 0.0
Time: 13.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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r10006 = xre;
        double r10007 = xim;
        double r10008 = /* ERROR: no complex support in C */;
        double r10009 = exp(r10008);
        double r10010 = -r10008;
        double r10011 = exp(r10010);
        double r10012 = r10009 + r10011;
        double r10013 = 2.0;
        double r10014 = 0.0;
        double r10015 = /* ERROR: no complex support in C */;
        double r10016 = r10012 / r10015;
        double r10017 = /* ERROR: no complex support in C */;
        return r10017;
}

double f(double xre, double xim) {
        double r10018 = xre;
        double r10019 = xim;
        double r10020 = /* ERROR: no complex support in C */;
        double r10021 = -r10020;
        double r10022 = exp(r10021);
        double r10023 = exp(r10020);
        double r10024 = r10022 + r10023;
        double r10025 = 2.0;
        double r10026 = 0.0;
        double r10027 = /* ERROR: no complex support in C */;
        double r10028 = r10024 / r10027;
        double r10029 = /* ERROR: no complex support in C */;
        return r10029;
}

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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  (re (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2.0 0.0))))