Average Error: 44.2 → 44.2
Time: 25.5s
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 r9101 = xre;
        double r9102 = xim;
        double r9103 = /* ERROR: no complex support in C */;
        double r9104 = exp(r9103);
        double r9105 = -r9103;
        double r9106 = exp(r9105);
        double r9107 = r9104 + r9106;
        double r9108 = 2.0;
        double r9109 = 0.0;
        double r9110 = /* ERROR: no complex support in C */;
        double r9111 = r9107 / r9110;
        double r9112 = /* ERROR: no complex support in C */;
        return r9112;
}

double f(double xre, double xim) {
        double r9113 = xre;
        double r9114 = xim;
        double r9115 = /* ERROR: no complex support in C */;
        double r9116 = exp(r9115);
        double r9117 = -r9115;
        double r9118 = exp(r9117);
        double r9119 = r9116 + r9118;
        double r9120 = 2.0;
        double r9121 = 0.0;
        double r9122 = /* ERROR: no complex support in C */;
        double r9123 = r9119 / r9122;
        double r9124 = /* ERROR: no complex support in C */;
        return r9124;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 44.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 simplification44.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 2019208 +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))))