Average Error: 43.8 → 43.8
Time: 18.2s
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 r9306 = xre;
        double r9307 = xim;
        double r9308 = /* ERROR: no complex support in C */;
        double r9309 = exp(r9308);
        double r9310 = -r9308;
        double r9311 = exp(r9310);
        double r9312 = r9309 + r9311;
        double r9313 = 2.0;
        double r9314 = 0.0;
        double r9315 = /* ERROR: no complex support in C */;
        double r9316 = r9312 / r9315;
        double r9317 = /* ERROR: no complex support in C */;
        return r9317;
}

double f(double xre, double xim) {
        double r9318 = xre;
        double r9319 = xim;
        double r9320 = /* ERROR: no complex support in C */;
        double r9321 = exp(r9320);
        double r9322 = -r9320;
        double r9323 = exp(r9322);
        double r9324 = r9321 + r9323;
        double r9325 = 2.0;
        double r9326 = 0.0;
        double r9327 = /* ERROR: no complex support in C */;
        double r9328 = r9324 / r9327;
        double r9329 = /* ERROR: no complex support in C */;
        return r9329;
}

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