Average Error: 43.5 → 43.5
Time: 27.1s
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 r9021 = xre;
        double r9022 = xim;
        double r9023 = /* ERROR: no complex support in C */;
        double r9024 = exp(r9023);
        double r9025 = -r9023;
        double r9026 = exp(r9025);
        double r9027 = r9024 + r9026;
        double r9028 = 2.0;
        double r9029 = 0.0;
        double r9030 = /* ERROR: no complex support in C */;
        double r9031 = r9027 / r9030;
        double r9032 = /* ERROR: no complex support in C */;
        return r9032;
}

double f(double xre, double xim) {
        double r9033 = xre;
        double r9034 = xim;
        double r9035 = /* ERROR: no complex support in C */;
        double r9036 = -r9035;
        double r9037 = exp(r9036);
        double r9038 = exp(r9035);
        double r9039 = r9037 + r9038;
        double r9040 = 2.0;
        double r9041 = 0.0;
        double r9042 = /* ERROR: no complex support in C */;
        double r9043 = r9039 / r9042;
        double r9044 = /* ERROR: no complex support in C */;
        return r9044;
}

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. Simplified43.5

    \[\leadsto \color{blue}{\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))}\]
  3. 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 2019196 
(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))))