Average Error: 43.4 → 43.4
Time: 10.6s
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 r16522 = xre;
        double r16523 = xim;
        double r16524 = /* ERROR: no complex support in C */;
        double r16525 = exp(r16524);
        double r16526 = -r16524;
        double r16527 = exp(r16526);
        double r16528 = r16525 + r16527;
        double r16529 = 2.0;
        double r16530 = 0.0;
        double r16531 = /* ERROR: no complex support in C */;
        double r16532 = r16528 / r16531;
        double r16533 = /* ERROR: no complex support in C */;
        return r16533;
}

double f(double xre, double xim) {
        double r16534 = xre;
        double r16535 = xim;
        double r16536 = /* ERROR: no complex support in C */;
        double r16537 = exp(r16536);
        double r16538 = -r16536;
        double r16539 = exp(r16538);
        double r16540 = r16537 + r16539;
        double r16541 = 2.0;
        double r16542 = 0.0;
        double r16543 = /* ERROR: no complex support in C */;
        double r16544 = r16540 / r16543;
        double r16545 = /* ERROR: no complex support in C */;
        return r16545;
}

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 2020060 +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))))