Average Error: 43.8 → 43.8
Time: 11.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 r17540 = xre;
        double r17541 = xim;
        double r17542 = /* ERROR: no complex support in C */;
        double r17543 = exp(r17542);
        double r17544 = -r17542;
        double r17545 = exp(r17544);
        double r17546 = r17543 + r17545;
        double r17547 = 2.0;
        double r17548 = 0.0;
        double r17549 = /* ERROR: no complex support in C */;
        double r17550 = r17546 / r17549;
        double r17551 = /* ERROR: no complex support in C */;
        return r17551;
}

double f(double xre, double xim) {
        double r17552 = xre;
        double r17553 = xim;
        double r17554 = /* ERROR: no complex support in C */;
        double r17555 = exp(r17554);
        double r17556 = -r17554;
        double r17557 = exp(r17556);
        double r17558 = r17555 + r17557;
        double r17559 = 2.0;
        double r17560 = 0.0;
        double r17561 = /* ERROR: no complex support in C */;
        double r17562 = r17558 / r17561;
        double r17563 = /* ERROR: no complex support in C */;
        return r17563;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.8

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

    \[\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 2019352 +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))))