Average Error: 43.2 → 43.2
Time: 10.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(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(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(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 r10243 = xre;
        double r10244 = xim;
        double r10245 = /* ERROR: no complex support in C */;
        double r10246 = exp(r10245);
        double r10247 = -r10245;
        double r10248 = exp(r10247);
        double r10249 = r10246 + r10248;
        double r10250 = 2.0;
        double r10251 = 0.0;
        double r10252 = /* ERROR: no complex support in C */;
        double r10253 = r10249 / r10252;
        double r10254 = /* ERROR: no complex support in C */;
        return r10254;
}

double f(double xre, double xim) {
        double r10255 = xre;
        double r10256 = xim;
        double r10257 = /* ERROR: no complex support in C */;
        double r10258 = exp(r10257);
        double r10259 = -r10257;
        double r10260 = exp(r10259);
        double r10261 = r10258 + r10260;
        double r10262 = 2.0;
        double r10263 = 0.0;
        double r10264 = /* ERROR: no complex support in C */;
        double r10265 = r10261 / r10264;
        double r10266 = /* ERROR: no complex support in C */;
        return r10266;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.2

    \[\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.2

    \[\leadsto \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))\]

Reproduce

herbie shell --seed 2020046 
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  :precision binary64
  (im (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2 0.0))))