Average Error: 43.2 → 43.2
Time: 10.4s
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 r17210 = xre;
        double r17211 = xim;
        double r17212 = /* ERROR: no complex support in C */;
        double r17213 = exp(r17212);
        double r17214 = -r17212;
        double r17215 = exp(r17214);
        double r17216 = r17213 + r17215;
        double r17217 = 2.0;
        double r17218 = 0.0;
        double r17219 = /* ERROR: no complex support in C */;
        double r17220 = r17216 / r17219;
        double r17221 = /* ERROR: no complex support in C */;
        return r17221;
}

double f(double xre, double xim) {
        double r17222 = xre;
        double r17223 = xim;
        double r17224 = /* ERROR: no complex support in C */;
        double r17225 = exp(r17224);
        double r17226 = -r17224;
        double r17227 = exp(r17226);
        double r17228 = r17225 + r17227;
        double r17229 = 2.0;
        double r17230 = 0.0;
        double r17231 = /* ERROR: no complex support in C */;
        double r17232 = r17228 / r17231;
        double r17233 = /* ERROR: no complex support in C */;
        return r17233;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.2

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

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