Average Error: 43.4 → 43.4
Time: 10.9s
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 r17328 = xre;
        double r17329 = xim;
        double r17330 = /* ERROR: no complex support in C */;
        double r17331 = exp(r17330);
        double r17332 = -r17330;
        double r17333 = exp(r17332);
        double r17334 = r17331 + r17333;
        double r17335 = 2.0;
        double r17336 = 0.0;
        double r17337 = /* ERROR: no complex support in C */;
        double r17338 = r17334 / r17337;
        double r17339 = /* ERROR: no complex support in C */;
        return r17339;
}

double f(double xre, double xim) {
        double r17340 = xre;
        double r17341 = xim;
        double r17342 = /* ERROR: no complex support in C */;
        double r17343 = exp(r17342);
        double r17344 = -r17342;
        double r17345 = exp(r17344);
        double r17346 = r17343 + r17345;
        double r17347 = 2.0;
        double r17348 = 0.0;
        double r17349 = /* ERROR: no complex support in C */;
        double r17350 = r17346 / r17349;
        double r17351 = /* ERROR: no complex support in C */;
        return r17351;
}

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