Average Error: 43.2 → 43.2
Time: 10.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 r13276 = xre;
        double r13277 = xim;
        double r13278 = /* ERROR: no complex support in C */;
        double r13279 = exp(r13278);
        double r13280 = -r13278;
        double r13281 = exp(r13280);
        double r13282 = r13279 + r13281;
        double r13283 = 2.0;
        double r13284 = 0.0;
        double r13285 = /* ERROR: no complex support in C */;
        double r13286 = r13282 / r13285;
        double r13287 = /* ERROR: no complex support in C */;
        return r13287;
}

double f(double xre, double xim) {
        double r13288 = xre;
        double r13289 = xim;
        double r13290 = /* ERROR: no complex support in C */;
        double r13291 = exp(r13290);
        double r13292 = -r13290;
        double r13293 = exp(r13292);
        double r13294 = r13291 + r13293;
        double r13295 = 2.0;
        double r13296 = 0.0;
        double r13297 = /* ERROR: no complex support in C */;
        double r13298 = r13294 / r13297;
        double r13299 = /* ERROR: no complex support in C */;
        return r13299;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.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 simplification43.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 2020046 +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))))