Average Error: 43.9 → 43.9
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 r9855 = xre;
        double r9856 = xim;
        double r9857 = /* ERROR: no complex support in C */;
        double r9858 = exp(r9857);
        double r9859 = -r9857;
        double r9860 = exp(r9859);
        double r9861 = r9858 + r9860;
        double r9862 = 2.0;
        double r9863 = 0.0;
        double r9864 = /* ERROR: no complex support in C */;
        double r9865 = r9861 / r9864;
        double r9866 = /* ERROR: no complex support in C */;
        return r9866;
}

double f(double xre, double xim) {
        double r9867 = xre;
        double r9868 = xim;
        double r9869 = /* ERROR: no complex support in C */;
        double r9870 = exp(r9869);
        double r9871 = -r9869;
        double r9872 = exp(r9871);
        double r9873 = r9870 + r9872;
        double r9874 = 2.0;
        double r9875 = 0.0;
        double r9876 = /* ERROR: no complex support in C */;
        double r9877 = r9873 / r9876;
        double r9878 = /* ERROR: no complex support in C */;
        return r9878;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.9

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

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