Average Error: 0.1 → 0.0
Time: 34.8s
Precision: 64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)\]
\[0.5 \cdot \mathsf{fma}\left(\left(\sin re\right), \left(e^{im}\right), \left(\frac{\sin re}{e^{im}}\right)\right)\]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
0.5 \cdot \mathsf{fma}\left(\left(\sin re\right), \left(e^{im}\right), \left(\frac{\sin re}{e^{im}}\right)\right)
double f(double re, double im) {
        double r1338313 = 0.5;
        double r1338314 = re;
        double r1338315 = sin(r1338314);
        double r1338316 = r1338313 * r1338315;
        double r1338317 = 0.0;
        double r1338318 = im;
        double r1338319 = r1338317 - r1338318;
        double r1338320 = exp(r1338319);
        double r1338321 = exp(r1338318);
        double r1338322 = r1338320 + r1338321;
        double r1338323 = r1338316 * r1338322;
        return r1338323;
}

double f(double re, double im) {
        double r1338324 = 0.5;
        double r1338325 = re;
        double r1338326 = sin(r1338325);
        double r1338327 = im;
        double r1338328 = exp(r1338327);
        double r1338329 = r1338326 / r1338328;
        double r1338330 = fma(r1338326, r1338328, r1338329);
        double r1338331 = r1338324 * r1338330;
        return r1338331;
}

Error

Bits error versus re

Bits error versus im

Derivation

  1. Initial program 0.1

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

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

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

Reproduce

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