Average Error: 43.7 → 43.7
Time: 26.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 i\right)}\right))\]
\[\Im(\left(\frac{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 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 i\right)}\right))
\Im(\left(\frac{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0 i\right)}\right))
double f(double xre, double xim) {
        double r10492 = xre;
        double r10493 = xim;
        double r10494 = /* ERROR: no complex support in C */;
        double r10495 = exp(r10494);
        double r10496 = -r10494;
        double r10497 = exp(r10496);
        double r10498 = r10495 + r10497;
        double r10499 = 2.0;
        double r10500 = 0.0;
        double r10501 = /* ERROR: no complex support in C */;
        double r10502 = r10498 / r10501;
        double r10503 = /* ERROR: no complex support in C */;
        return r10503;
}

double f(double xre, double xim) {
        double r10504 = xre;
        double r10505 = xim;
        double r10506 = /* ERROR: no complex support in C */;
        double r10507 = -r10506;
        double r10508 = exp(r10507);
        double r10509 = exp(r10506);
        double r10510 = r10508 + r10509;
        double r10511 = 2.0;
        double r10512 = 0.0;
        double r10513 = /* ERROR: no complex support in C */;
        double r10514 = r10510 / r10513;
        double r10515 = /* ERROR: no complex support in C */;
        return r10515;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.7

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

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

Reproduce

herbie shell --seed 2019163 +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))))