Average Error: 0.0 → 0.0
Time: 15.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(-\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 r10045 = xre;
        double r10046 = xim;
        double r10047 = /* ERROR: no complex support in C */;
        double r10048 = exp(r10047);
        double r10049 = -r10047;
        double r10050 = exp(r10049);
        double r10051 = r10048 + r10050;
        double r10052 = 2.0;
        double r10053 = 0.0;
        double r10054 = /* ERROR: no complex support in C */;
        double r10055 = r10051 / r10054;
        double r10056 = /* ERROR: no complex support in C */;
        return r10056;
}

double f(double xre, double xim) {
        double r10057 = xre;
        double r10058 = xim;
        double r10059 = /* ERROR: no complex support in C */;
        double r10060 = -r10059;
        double r10061 = exp(r10060);
        double r10062 = exp(r10059);
        double r10063 = r10061 + r10062;
        double r10064 = 2.0;
        double r10065 = 0.0;
        double r10066 = /* ERROR: no complex support in C */;
        double r10067 = r10063 / r10066;
        double r10068 = /* ERROR: no complex support in C */;
        return r10068;
}

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