Average Error: 43.5 → 43.5
Time: 11.2s
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 r22108 = xre;
        double r22109 = xim;
        double r22110 = /* ERROR: no complex support in C */;
        double r22111 = exp(r22110);
        double r22112 = -r22110;
        double r22113 = exp(r22112);
        double r22114 = r22111 + r22113;
        double r22115 = 2.0;
        double r22116 = 0.0;
        double r22117 = /* ERROR: no complex support in C */;
        double r22118 = r22114 / r22117;
        double r22119 = /* ERROR: no complex support in C */;
        return r22119;
}

double f(double xre, double xim) {
        double r22120 = xre;
        double r22121 = xim;
        double r22122 = /* ERROR: no complex support in C */;
        double r22123 = exp(r22122);
        double r22124 = -r22122;
        double r22125 = exp(r22124);
        double r22126 = r22123 + r22125;
        double r22127 = 2.0;
        double r22128 = 0.0;
        double r22129 = /* ERROR: no complex support in C */;
        double r22130 = r22126 / r22129;
        double r22131 = /* ERROR: no complex support in C */;
        return r22131;
}

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(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 2020042 +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))))