Average Error: 43.7 → 43.7
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 r13463 = xre;
        double r13464 = xim;
        double r13465 = /* ERROR: no complex support in C */;
        double r13466 = exp(r13465);
        double r13467 = -r13465;
        double r13468 = exp(r13467);
        double r13469 = r13466 + r13468;
        double r13470 = 2.0;
        double r13471 = 0.0;
        double r13472 = /* ERROR: no complex support in C */;
        double r13473 = r13469 / r13472;
        double r13474 = /* ERROR: no complex support in C */;
        return r13474;
}

double f(double xre, double xim) {
        double r13475 = xre;
        double r13476 = xim;
        double r13477 = /* ERROR: no complex support in C */;
        double r13478 = exp(r13477);
        double r13479 = -r13477;
        double r13480 = exp(r13479);
        double r13481 = r13478 + r13480;
        double r13482 = 2.0;
        double r13483 = 0.0;
        double r13484 = /* ERROR: no complex support in C */;
        double r13485 = r13481 / r13484;
        double r13486 = /* ERROR: no complex support in C */;
        return r13486;
}

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.0 i\right)}\right))\]
  2. Final simplification43.7

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