Average Error: 0.0 → 0.0
Time: 21.0s
Precision: 64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0.0 - im} + e^{im}\right)\]
\[\mathsf{fma}\left(\sin re, e^{0.0 - im} \cdot 0.5, \left(e^{im} \cdot \sin re\right) \cdot 0.5\right)\]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0.0 - im} + e^{im}\right)
\mathsf{fma}\left(\sin re, e^{0.0 - im} \cdot 0.5, \left(e^{im} \cdot \sin re\right) \cdot 0.5\right)
double f(double re, double im) {
        double r18367 = 0.5;
        double r18368 = re;
        double r18369 = sin(r18368);
        double r18370 = r18367 * r18369;
        double r18371 = 0.0;
        double r18372 = im;
        double r18373 = r18371 - r18372;
        double r18374 = exp(r18373);
        double r18375 = exp(r18372);
        double r18376 = r18374 + r18375;
        double r18377 = r18370 * r18376;
        return r18377;
}

double f(double re, double im) {
        double r18378 = re;
        double r18379 = sin(r18378);
        double r18380 = 0.0;
        double r18381 = im;
        double r18382 = r18380 - r18381;
        double r18383 = exp(r18382);
        double r18384 = 0.5;
        double r18385 = r18383 * r18384;
        double r18386 = exp(r18381);
        double r18387 = r18386 * r18379;
        double r18388 = r18387 * r18384;
        double r18389 = fma(r18379, r18385, r18388);
        return r18389;
}

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.0 - im} + e^{im}\right)\]
  2. Using strategy rm
  3. Applied distribute-lft-in0.0

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

    \[\leadsto \color{blue}{\sin re \cdot \left(e^{0.0 - im} \cdot 0.5\right)} + \left(0.5 \cdot \sin re\right) \cdot e^{im}\]
  5. Simplified0.0

    \[\leadsto \sin re \cdot \left(e^{0.0 - im} \cdot 0.5\right) + \color{blue}{0.5 \cdot \left(\sin re \cdot e^{im}\right)}\]
  6. Using strategy rm
  7. Applied fma-def0.0

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

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

Reproduce

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