Average Error: 0.0 → 0.0
Time: 14.0s
Precision: 64
\[\Re(\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))\]
\[\Re(\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))\]
\Re(\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))
\Re(\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 r8934 = xre;
        double r8935 = xim;
        double r8936 = /* ERROR: no complex support in C */;
        double r8937 = exp(r8936);
        double r8938 = -r8936;
        double r8939 = exp(r8938);
        double r8940 = r8937 + r8939;
        double r8941 = 2.0;
        double r8942 = 0.0;
        double r8943 = /* ERROR: no complex support in C */;
        double r8944 = r8940 / r8943;
        double r8945 = /* ERROR: no complex support in C */;
        return r8945;
}

double f(double xre, double xim) {
        double r8946 = xre;
        double r8947 = xim;
        double r8948 = /* ERROR: no complex support in C */;
        double r8949 = -r8948;
        double r8950 = exp(r8949);
        double r8951 = exp(r8948);
        double r8952 = r8950 + r8951;
        double r8953 = 2.0;
        double r8954 = 0.0;
        double r8955 = /* ERROR: no complex support in C */;
        double r8956 = r8952 / r8955;
        double r8957 = /* ERROR: no complex support in C */;
        return r8957;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{\Re(\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 simplification0.0

    \[\leadsto \Re(\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 real part (p55)"
  (re (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2.0 0.0))))