Average Error: 43.5 → 43.5
Time: 10.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 r21935 = xre;
        double r21936 = xim;
        double r21937 = /* ERROR: no complex support in C */;
        double r21938 = exp(r21937);
        double r21939 = -r21937;
        double r21940 = exp(r21939);
        double r21941 = r21938 + r21940;
        double r21942 = 2.0;
        double r21943 = 0.0;
        double r21944 = /* ERROR: no complex support in C */;
        double r21945 = r21941 / r21944;
        double r21946 = /* ERROR: no complex support in C */;
        return r21946;
}

double f(double xre, double xim) {
        double r21947 = xre;
        double r21948 = xim;
        double r21949 = /* ERROR: no complex support in C */;
        double r21950 = exp(r21949);
        double r21951 = -r21949;
        double r21952 = exp(r21951);
        double r21953 = r21950 + r21952;
        double r21954 = 2.0;
        double r21955 = 0.0;
        double r21956 = /* ERROR: no complex support in C */;
        double r21957 = r21953 / r21956;
        double r21958 = /* ERROR: no complex support in C */;
        return r21958;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.5

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

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