Average Error: 43.6 → 43.6
Time: 26.3s
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 r8921 = xre;
        double r8922 = xim;
        double r8923 = /* ERROR: no complex support in C */;
        double r8924 = exp(r8923);
        double r8925 = -r8923;
        double r8926 = exp(r8925);
        double r8927 = r8924 + r8926;
        double r8928 = 2.0;
        double r8929 = 0.0;
        double r8930 = /* ERROR: no complex support in C */;
        double r8931 = r8927 / r8930;
        double r8932 = /* ERROR: no complex support in C */;
        return r8932;
}

double f(double xre, double xim) {
        double r8933 = xre;
        double r8934 = xim;
        double r8935 = /* ERROR: no complex support in C */;
        double r8936 = -r8935;
        double r8937 = exp(r8936);
        double r8938 = exp(r8935);
        double r8939 = r8937 + r8938;
        double r8940 = 2.0;
        double r8941 = 0.0;
        double r8942 = /* ERROR: no complex support in C */;
        double r8943 = r8939 / r8942;
        double r8944 = /* ERROR: no complex support in C */;
        return r8944;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.6

    \[\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. Simplified43.6

    \[\leadsto \color{blue}{\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))}\]
  3. Final simplification43.6

    \[\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 2019179 
(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))))