Average Error: 43.2 → 43.2
Time: 26.8s
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 r9033 = xre;
        double r9034 = xim;
        double r9035 = /* ERROR: no complex support in C */;
        double r9036 = exp(r9035);
        double r9037 = -r9035;
        double r9038 = exp(r9037);
        double r9039 = r9036 + r9038;
        double r9040 = 2.0;
        double r9041 = 0.0;
        double r9042 = /* ERROR: no complex support in C */;
        double r9043 = r9039 / r9042;
        double r9044 = /* ERROR: no complex support in C */;
        return r9044;
}

double f(double xre, double xim) {
        double r9045 = xre;
        double r9046 = xim;
        double r9047 = /* ERROR: no complex support in C */;
        double r9048 = exp(r9047);
        double r9049 = -r9047;
        double r9050 = exp(r9049);
        double r9051 = r9048 + r9050;
        double r9052 = 2.0;
        double r9053 = 0.0;
        double r9054 = /* ERROR: no complex support in C */;
        double r9055 = r9051 / r9054;
        double r9056 = /* ERROR: no complex support in C */;
        return r9056;
}

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 2019323 +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))))