Average Error: 43.5 → 43.5
Time: 27.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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r10296 = xre;
        double r10297 = xim;
        double r10298 = /* ERROR: no complex support in C */;
        double r10299 = exp(r10298);
        double r10300 = -r10298;
        double r10301 = exp(r10300);
        double r10302 = r10299 + r10301;
        double r10303 = 2.0;
        double r10304 = 0.0;
        double r10305 = /* ERROR: no complex support in C */;
        double r10306 = r10302 / r10305;
        double r10307 = /* ERROR: no complex support in C */;
        return r10307;
}

double f(double xre, double xim) {
        double r10308 = xre;
        double r10309 = xim;
        double r10310 = /* ERROR: no complex support in C */;
        double r10311 = -r10310;
        double r10312 = exp(r10311);
        double r10313 = exp(r10310);
        double r10314 = r10312 + r10313;
        double r10315 = 2.0;
        double r10316 = 0.0;
        double r10317 = /* ERROR: no complex support in C */;
        double r10318 = r10314 / r10317;
        double r10319 = /* ERROR: no complex support in C */;
        return r10319;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.5

    \[\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.5

    \[\leadsto \Im(\left(\frac{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  (im (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2.0 0.0))))