Average Error: 43.5 → 43.5
Time: 26.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 r8971 = xre;
        double r8972 = xim;
        double r8973 = /* ERROR: no complex support in C */;
        double r8974 = exp(r8973);
        double r8975 = -r8973;
        double r8976 = exp(r8975);
        double r8977 = r8974 + r8976;
        double r8978 = 2.0;
        double r8979 = 0.0;
        double r8980 = /* ERROR: no complex support in C */;
        double r8981 = r8977 / r8980;
        double r8982 = /* ERROR: no complex support in C */;
        return r8982;
}

double f(double xre, double xim) {
        double r8983 = xre;
        double r8984 = xim;
        double r8985 = /* ERROR: no complex support in C */;
        double r8986 = -r8985;
        double r8987 = exp(r8986);
        double r8988 = exp(r8985);
        double r8989 = r8987 + r8988;
        double r8990 = 2.0;
        double r8991 = 0.0;
        double r8992 = /* ERROR: no complex support in C */;
        double r8993 = r8989 / r8992;
        double r8994 = /* ERROR: no complex support in C */;
        return r8994;
}

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 2019174 
(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))))