Average Error: 43.5 → 43.5
Time: 26.0s
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 i\right)}\right))\]
\[\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\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 i\right)}\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 r10469 = xre;
        double r10470 = xim;
        double r10471 = /* ERROR: no complex support in C */;
        double r10472 = exp(r10471);
        double r10473 = -r10471;
        double r10474 = exp(r10473);
        double r10475 = r10472 + r10474;
        double r10476 = 2.0;
        double r10477 = 0.0;
        double r10478 = /* ERROR: no complex support in C */;
        double r10479 = r10475 / r10478;
        double r10480 = /* ERROR: no complex support in C */;
        return r10480;
}

double f(double xre, double xim) {
        double r10481 = xre;
        double r10482 = xim;
        double r10483 = /* ERROR: no complex support in C */;
        double r10484 = -r10483;
        double r10485 = exp(r10484);
        double r10486 = exp(r10483);
        double r10487 = r10485 + r10486;
        double r10488 = 2.0;
        double r10489 = 0.0;
        double r10490 = /* ERROR: no complex support in C */;
        double r10491 = r10487 / r10490;
        double r10492 = /* ERROR: no complex support in C */;
        return r10492;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.5

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

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

Reproduce

herbie shell --seed 2019154 +o rules:numerics
(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))))