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(0.5, \left(e^{im}\right), \left(\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{e^{im}}\right)\right) \cdot \sin re\]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\mathsf{fma}\left(0.5, \left(e^{im}\right), \left(\sqrt{0.5} \cdot \frac{\sqrt{0.5}}{e^{im}}\right)\right) \cdot \sin re
double f(double re, double im) {
        double r395166 = 0.5;
        double r395167 = re;
        double r395168 = sin(r395167);
        double r395169 = r395166 * r395168;
        double r395170 = 0.0;
        double r395171 = im;
        double r395172 = r395170 - r395171;
        double r395173 = exp(r395172);
        double r395174 = exp(r395171);
        double r395175 = r395173 + r395174;
        double r395176 = r395169 * r395175;
        return r395176;
}

double f(double re, double im) {
        double r395177 = 0.5;
        double r395178 = im;
        double r395179 = exp(r395178);
        double r395180 = sqrt(r395177);
        double r395181 = r395180 / r395179;
        double r395182 = r395180 * r395181;
        double r395183 = fma(r395177, r395179, r395182);
        double r395184 = re;
        double r395185 = sin(r395184);
        double r395186 = r395183 * r395185;
        return r395186;
}

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}{\sin re \cdot \mathsf{fma}\left(0.5, \left(e^{im}\right), \left(\frac{0.5}{e^{im}}\right)\right)}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.0

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, \left(e^{im}\right), \left(\frac{0.5}{\color{blue}{1 \cdot e^{im}}}\right)\right)\]
  5. Applied add-sqr-sqrt0.1

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, \left(e^{im}\right), \left(\frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{1 \cdot e^{im}}\right)\right)\]
  6. Applied times-frac0.0

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, \left(e^{im}\right), \color{blue}{\left(\frac{\sqrt{0.5}}{1} \cdot \frac{\sqrt{0.5}}{e^{im}}\right)}\right)\]
  7. Simplified0.0

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

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

Reproduce

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