Average Error: 43.3 → 43.3
Time: 26.0s
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 r9122 = xre;
        double r9123 = xim;
        double r9124 = /* ERROR: no complex support in C */;
        double r9125 = exp(r9124);
        double r9126 = -r9124;
        double r9127 = exp(r9126);
        double r9128 = r9125 + r9127;
        double r9129 = 2.0;
        double r9130 = 0.0;
        double r9131 = /* ERROR: no complex support in C */;
        double r9132 = r9128 / r9131;
        double r9133 = /* ERROR: no complex support in C */;
        return r9133;
}

double f(double xre, double xim) {
        double r9134 = xre;
        double r9135 = xim;
        double r9136 = /* ERROR: no complex support in C */;
        double r9137 = exp(r9136);
        double r9138 = -r9136;
        double r9139 = exp(r9138);
        double r9140 = r9137 + r9139;
        double r9141 = 2.0;
        double r9142 = 0.0;
        double r9143 = /* ERROR: no complex support in C */;
        double r9144 = r9140 / r9143;
        double r9145 = /* ERROR: no complex support in C */;
        return r9145;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.3

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

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