Average Error: 43.1 → 43.1
Time: 10.7s
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 r9169 = xre;
        double r9170 = xim;
        double r9171 = /* ERROR: no complex support in C */;
        double r9172 = exp(r9171);
        double r9173 = -r9171;
        double r9174 = exp(r9173);
        double r9175 = r9172 + r9174;
        double r9176 = 2.0;
        double r9177 = 0.0;
        double r9178 = /* ERROR: no complex support in C */;
        double r9179 = r9175 / r9178;
        double r9180 = /* ERROR: no complex support in C */;
        return r9180;
}

double f(double xre, double xim) {
        double r9181 = xre;
        double r9182 = xim;
        double r9183 = /* ERROR: no complex support in C */;
        double r9184 = exp(r9183);
        double r9185 = -r9183;
        double r9186 = exp(r9185);
        double r9187 = r9184 + r9186;
        double r9188 = 2.0;
        double r9189 = 0.0;
        double r9190 = /* ERROR: no complex support in C */;
        double r9191 = r9187 / r9190;
        double r9192 = /* ERROR: no complex support in C */;
        return r9192;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.1

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

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