Average Error: 43.6 → 43.6
Time: 27.0s
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 r9993 = xre;
        double r9994 = xim;
        double r9995 = /* ERROR: no complex support in C */;
        double r9996 = exp(r9995);
        double r9997 = -r9995;
        double r9998 = exp(r9997);
        double r9999 = r9996 + r9998;
        double r10000 = 2.0;
        double r10001 = 0.0;
        double r10002 = /* ERROR: no complex support in C */;
        double r10003 = r9999 / r10002;
        double r10004 = /* ERROR: no complex support in C */;
        return r10004;
}

double f(double xre, double xim) {
        double r10005 = xre;
        double r10006 = xim;
        double r10007 = /* ERROR: no complex support in C */;
        double r10008 = -r10007;
        double r10009 = exp(r10008);
        double r10010 = exp(r10007);
        double r10011 = r10009 + r10010;
        double r10012 = 2.0;
        double r10013 = 0.0;
        double r10014 = /* ERROR: no complex support in C */;
        double r10015 = r10011 / r10014;
        double r10016 = /* ERROR: no complex support in C */;
        return r10016;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.6

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

    \[\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 2019179 +o rules:numerics
(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))))