Average Error: 0.0 → 0.0
Time: 22.1s
Precision: 64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)\]
\[\mathsf{fma}\left(\left(e^{im}\right), \left(\sin re\right), \left(\frac{\sin re}{e^{im}}\right)\right) \cdot 0.5\]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\mathsf{fma}\left(\left(e^{im}\right), \left(\sin re\right), \left(\frac{\sin re}{e^{im}}\right)\right) \cdot 0.5
double f(double re, double im) {
        double r558243 = 0.5;
        double r558244 = re;
        double r558245 = sin(r558244);
        double r558246 = r558243 * r558245;
        double r558247 = 0.0;
        double r558248 = im;
        double r558249 = r558247 - r558248;
        double r558250 = exp(r558249);
        double r558251 = exp(r558248);
        double r558252 = r558250 + r558251;
        double r558253 = r558246 * r558252;
        return r558253;
}

double f(double re, double im) {
        double r558254 = im;
        double r558255 = exp(r558254);
        double r558256 = re;
        double r558257 = sin(r558256);
        double r558258 = r558257 / r558255;
        double r558259 = fma(r558255, r558257, r558258);
        double r558260 = 0.5;
        double r558261 = r558259 * r558260;
        return r558261;
}

Error

Bits error versus re

Bits error versus im

Derivation

  1. Initial program 0.0

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, \left(e^{im}\right), \left(\frac{0.5}{e^{im}}\right)\right)}\]
  3. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{\sin re \cdot \left(0.5 \cdot e^{im} + 0.5 \cdot \frac{1}{e^{im}}\right)}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(e^{im}\right), \left(\sin re\right), \left(\frac{\sin re}{e^{im}}\right)\right) \cdot 0.5}\]
  5. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(\left(e^{im}\right), \left(\sin re\right), \left(\frac{\sin re}{e^{im}}\right)\right) \cdot 0.5\]

Reproduce

herbie shell --seed 2019130 +o rules:numerics
(FPCore (re im)
  :name "math.sin on complex, real part"
  (* (* 0.5 (sin re)) (+ (exp (- 0 im)) (exp im))))