Average Error: 43.6 → 43.6
Time: 26.8s
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 r8982 = xre;
        double r8983 = xim;
        double r8984 = /* ERROR: no complex support in C */;
        double r8985 = exp(r8984);
        double r8986 = -r8984;
        double r8987 = exp(r8986);
        double r8988 = r8985 + r8987;
        double r8989 = 2.0;
        double r8990 = 0.0;
        double r8991 = /* ERROR: no complex support in C */;
        double r8992 = r8988 / r8991;
        double r8993 = /* ERROR: no complex support in C */;
        return r8993;
}

double f(double xre, double xim) {
        double r8994 = xre;
        double r8995 = xim;
        double r8996 = /* ERROR: no complex support in C */;
        double r8997 = -r8996;
        double r8998 = exp(r8997);
        double r8999 = exp(r8996);
        double r9000 = r8998 + r8999;
        double r9001 = 2.0;
        double r9002 = 0.0;
        double r9003 = /* ERROR: no complex support in C */;
        double r9004 = r9000 / r9003;
        double r9005 = /* ERROR: no complex support in C */;
        return r9005;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.6

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

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