Average Error: 0.0 → 0.0
Time: 17.2s
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 r339096 = 0.5;
        double r339097 = re;
        double r339098 = sin(r339097);
        double r339099 = r339096 * r339098;
        double r339100 = 0.0;
        double r339101 = im;
        double r339102 = r339100 - r339101;
        double r339103 = exp(r339102);
        double r339104 = exp(r339101);
        double r339105 = r339103 + r339104;
        double r339106 = r339099 * r339105;
        return r339106;
}

double f(double re, double im) {
        double r339107 = 0.5;
        double r339108 = re;
        double r339109 = sin(r339108);
        double r339110 = im;
        double r339111 = exp(r339110);
        double r339112 = r339109 / r339111;
        double r339113 = fma(r339109, r339111, r339112);
        double r339114 = r339107 * r339113;
        return r339114;
}

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}{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 2019120 +o rules:numerics
(FPCore (re im)
  :name "math.sin on complex, real part"
  (* (* 0.5 (sin re)) (+ (exp (- 0 im)) (exp im))))