Average Error: 43.3 → 43.3
Time: 26.7s
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 r9124 = xre;
        double r9125 = xim;
        double r9126 = /* ERROR: no complex support in C */;
        double r9127 = exp(r9126);
        double r9128 = -r9126;
        double r9129 = exp(r9128);
        double r9130 = r9127 + r9129;
        double r9131 = 2.0;
        double r9132 = 0.0;
        double r9133 = /* ERROR: no complex support in C */;
        double r9134 = r9130 / r9133;
        double r9135 = /* ERROR: no complex support in C */;
        return r9135;
}

double f(double xre, double xim) {
        double r9136 = xre;
        double r9137 = xim;
        double r9138 = /* ERROR: no complex support in C */;
        double r9139 = exp(r9138);
        double r9140 = -r9138;
        double r9141 = exp(r9140);
        double r9142 = r9139 + r9141;
        double r9143 = 2.0;
        double r9144 = 0.0;
        double r9145 = /* ERROR: no complex support in C */;
        double r9146 = r9142 / r9145;
        double r9147 = /* ERROR: no complex support in C */;
        return r9147;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.3

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

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