Average Error: 44.1 → 44.1
Time: 25.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 r9154 = xre;
        double r9155 = xim;
        double r9156 = /* ERROR: no complex support in C */;
        double r9157 = exp(r9156);
        double r9158 = -r9156;
        double r9159 = exp(r9158);
        double r9160 = r9157 + r9159;
        double r9161 = 2.0;
        double r9162 = 0.0;
        double r9163 = /* ERROR: no complex support in C */;
        double r9164 = r9160 / r9163;
        double r9165 = /* ERROR: no complex support in C */;
        return r9165;
}

double f(double xre, double xim) {
        double r9166 = xre;
        double r9167 = xim;
        double r9168 = /* ERROR: no complex support in C */;
        double r9169 = exp(r9168);
        double r9170 = -r9168;
        double r9171 = exp(r9170);
        double r9172 = r9169 + r9171;
        double r9173 = 2.0;
        double r9174 = 0.0;
        double r9175 = /* ERROR: no complex support in C */;
        double r9176 = r9172 / r9175;
        double r9177 = /* ERROR: no complex support in C */;
        return r9177;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 44.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 simplification44.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 2019322 +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))))