Average Error: 43.7 → 43.7
Time: 26.9s
Precision: 64
\[\Im(\left(\frac{e^{xre + xim i} + e^{-\left(xre + xim i\right)}}{2 + 0 i}\right))\]
\[\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))\]
double f(double xre, double xim) {
        double r12099 = xre;
        double r12100 = xim;
        double r12101 = /* ERROR: no complex support in C */;
        double r12102 = exp(r12101);
        double r12103 = -r12101;
        double r12104 = exp(r12103);
        double r12105 = r12102 + r12104;
        double r12106 = 2.0;
        double r12107 = 0.0;
        double r12108 = /* ERROR: no complex support in C */;
        double r12109 = r12105 / r12108;
        double r12110 = /* ERROR: no complex support in C */;
        return r12110;
}

double f(double xre, double xim) {
        double r12111 = xre;
        double r12112 = xim;
        double r12113 = /* ERROR: no complex support in C */;
        double r12114 = -r12113;
        double r12115 = exp(r12114);
        double r12116 = exp(r12113);
        double r12117 = r12115 + r12116;
        double r12118 = 2.0;
        double r12119 = 0.0;
        double r12120 = /* ERROR: no complex support in C */;
        double r12121 = r12117 / r12120;
        double r12122 = /* ERROR: no complex support in C */;
        return r12122;
}

\Im(\left(\frac{e^{xre + xim i} + e^{-\left(xre + xim i\right)}}{2 + 0 i}\right))
\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.7

    \[\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 i\right)}\right))\]
  2. Final simplification43.7

    \[\leadsto \Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))\]

Reproduce

herbie shell --seed 2019101 
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  (im (/.c (+.c (exp.c (complex xre xim)) (exp.c (neg.c (complex xre xim)))) (complex 2 0))))