Average Error: 43.5 → 43.5
Time: 26.8s
Precision: 64
\[\Im(\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))\]
\[\Im(\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))\]
\Im(\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))
\Im(\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 r10021 = xre;
        double r10022 = xim;
        double r10023 = /* ERROR: no complex support in C */;
        double r10024 = exp(r10023);
        double r10025 = -r10023;
        double r10026 = exp(r10025);
        double r10027 = r10024 + r10026;
        double r10028 = 2.0;
        double r10029 = 0.0;
        double r10030 = /* ERROR: no complex support in C */;
        double r10031 = r10027 / r10030;
        double r10032 = /* ERROR: no complex support in C */;
        return r10032;
}

double f(double xre, double xim) {
        double r10033 = xre;
        double r10034 = xim;
        double r10035 = /* ERROR: no complex support in C */;
        double r10036 = -r10035;
        double r10037 = exp(r10036);
        double r10038 = exp(r10035);
        double r10039 = r10037 + r10038;
        double r10040 = 2.0;
        double r10041 = 0.0;
        double r10042 = /* ERROR: no complex support in C */;
        double r10043 = r10039 / r10042;
        double r10044 = /* ERROR: no complex support in C */;
        return r10044;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.5

    \[\Im(\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 simplification43.5

    \[\leadsto \Im(\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 2019169 
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  (im (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2.0 0.0))))