Average Error: 0.0 → 0.0
Time: 19.5s
Precision: 64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)\]
\[\mathsf{fma}\left(\left(\sin re\right), \left(e^{im}\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(\sin re\right), \left(e^{im}\right), \left(\frac{\sin re}{e^{im}}\right)\right) \cdot 0.5
double f(double re, double im) {
        double r530106 = 0.5;
        double r530107 = re;
        double r530108 = sin(r530107);
        double r530109 = r530106 * r530108;
        double r530110 = 0.0;
        double r530111 = im;
        double r530112 = r530110 - r530111;
        double r530113 = exp(r530112);
        double r530114 = exp(r530111);
        double r530115 = r530113 + r530114;
        double r530116 = r530109 * r530115;
        return r530116;
}

double f(double re, double im) {
        double r530117 = re;
        double r530118 = sin(r530117);
        double r530119 = im;
        double r530120 = exp(r530119);
        double r530121 = r530118 / r530120;
        double r530122 = fma(r530118, r530120, r530121);
        double r530123 = 0.5;
        double r530124 = r530122 * r530123;
        return r530124;
}

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. Taylor expanded around inf 0.0

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

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

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

Reproduce

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