Average Error: 43.4 → 43.4
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 r18547 = xre;
        double r18548 = xim;
        double r18549 = /* ERROR: no complex support in C */;
        double r18550 = exp(r18549);
        double r18551 = -r18549;
        double r18552 = exp(r18551);
        double r18553 = r18550 + r18552;
        double r18554 = 2.0;
        double r18555 = 0.0;
        double r18556 = /* ERROR: no complex support in C */;
        double r18557 = r18553 / r18556;
        double r18558 = /* ERROR: no complex support in C */;
        return r18558;
}

double f(double xre, double xim) {
        double r18559 = xre;
        double r18560 = xim;
        double r18561 = /* ERROR: no complex support in C */;
        double r18562 = exp(r18561);
        double r18563 = -r18561;
        double r18564 = exp(r18563);
        double r18565 = r18562 + r18564;
        double r18566 = 2.0;
        double r18567 = 0.0;
        double r18568 = /* ERROR: no complex support in C */;
        double r18569 = r18565 / r18568;
        double r18570 = /* ERROR: no complex support in C */;
        return r18570;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.4

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

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