Average Error: 43.0 → 43.0
Time: 27.6s
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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r9034 = xre;
        double r9035 = xim;
        double r9036 = /* ERROR: no complex support in C */;
        double r9037 = exp(r9036);
        double r9038 = -r9036;
        double r9039 = exp(r9038);
        double r9040 = r9037 + r9039;
        double r9041 = 2.0;
        double r9042 = 0.0;
        double r9043 = /* ERROR: no complex support in C */;
        double r9044 = r9040 / r9043;
        double r9045 = /* ERROR: no complex support in C */;
        return r9045;
}

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

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.0

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

    \[\leadsto \Im(\left(\frac{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2019195 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  (im (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2.0 0.0))))