Average Error: 43.2 → 43.2
Time: 11.5s
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 r15831 = xre;
        double r15832 = xim;
        double r15833 = /* ERROR: no complex support in C */;
        double r15834 = exp(r15833);
        double r15835 = -r15833;
        double r15836 = exp(r15835);
        double r15837 = r15834 + r15836;
        double r15838 = 2.0;
        double r15839 = 0.0;
        double r15840 = /* ERROR: no complex support in C */;
        double r15841 = r15837 / r15840;
        double r15842 = /* ERROR: no complex support in C */;
        return r15842;
}

double f(double xre, double xim) {
        double r15843 = xre;
        double r15844 = xim;
        double r15845 = /* ERROR: no complex support in C */;
        double r15846 = exp(r15845);
        double r15847 = -r15845;
        double r15848 = exp(r15847);
        double r15849 = r15846 + r15848;
        double r15850 = 2.0;
        double r15851 = 0.0;
        double r15852 = /* ERROR: no complex support in C */;
        double r15853 = r15849 / r15852;
        double r15854 = /* ERROR: no complex support in C */;
        return r15854;
}

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