Average Error: 0.0 → 0.0
Time: 20.3s
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 r260255 = 0.5;
        double r260256 = re;
        double r260257 = sin(r260256);
        double r260258 = r260255 * r260257;
        double r260259 = 0.0;
        double r260260 = im;
        double r260261 = r260259 - r260260;
        double r260262 = exp(r260261);
        double r260263 = exp(r260260);
        double r260264 = r260262 + r260263;
        double r260265 = r260258 * r260264;
        return r260265;
}

double f(double re, double im) {
        double r260266 = 0.5;
        double r260267 = re;
        double r260268 = sin(r260267);
        double r260269 = im;
        double r260270 = exp(r260269);
        double r260271 = r260268 / r260270;
        double r260272 = fma(r260268, r260270, r260271);
        double r260273 = r260266 * r260272;
        return r260273;
}

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