Average Error: 43.8 → 43.8
Time: 10.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.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 r17521 = xre;
        double r17522 = xim;
        double r17523 = /* ERROR: no complex support in C */;
        double r17524 = exp(r17523);
        double r17525 = -r17523;
        double r17526 = exp(r17525);
        double r17527 = r17524 + r17526;
        double r17528 = 2.0;
        double r17529 = 0.0;
        double r17530 = /* ERROR: no complex support in C */;
        double r17531 = r17527 / r17530;
        double r17532 = /* ERROR: no complex support in C */;
        return r17532;
}

double f(double xre, double xim) {
        double r17533 = xre;
        double r17534 = xim;
        double r17535 = /* ERROR: no complex support in C */;
        double r17536 = exp(r17535);
        double r17537 = -r17535;
        double r17538 = exp(r17537);
        double r17539 = r17536 + r17538;
        double r17540 = 2.0;
        double r17541 = 0.0;
        double r17542 = /* ERROR: no complex support in C */;
        double r17543 = r17539 / r17542;
        double r17544 = /* ERROR: no complex support in C */;
        return r17544;
}

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