Average Error: 43.3 → 43.3
Time: 27.4s
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 r9115 = xre;
        double r9116 = xim;
        double r9117 = /* ERROR: no complex support in C */;
        double r9118 = exp(r9117);
        double r9119 = -r9117;
        double r9120 = exp(r9119);
        double r9121 = r9118 + r9120;
        double r9122 = 2.0;
        double r9123 = 0.0;
        double r9124 = /* ERROR: no complex support in C */;
        double r9125 = r9121 / r9124;
        double r9126 = /* ERROR: no complex support in C */;
        return r9126;
}

double f(double xre, double xim) {
        double r9127 = xre;
        double r9128 = xim;
        double r9129 = /* ERROR: no complex support in C */;
        double r9130 = exp(r9129);
        double r9131 = -r9129;
        double r9132 = exp(r9131);
        double r9133 = r9130 + r9132;
        double r9134 = 2.0;
        double r9135 = 0.0;
        double r9136 = /* ERROR: no complex support in C */;
        double r9137 = r9133 / r9136;
        double r9138 = /* ERROR: no complex support in C */;
        return r9138;
}

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 2019326 +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))))