Average Error: 0.0 → 0.0
Time: 18.0s
Precision: 64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)\]
\[0.5 \cdot \mathsf{fma}\left(e^{im}, \sin re, \frac{\sin re}{e^{im}}\right)\]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
0.5 \cdot \mathsf{fma}\left(e^{im}, \sin re, \frac{\sin re}{e^{im}}\right)
double f(double re, double im) {
        double r403257 = 0.5;
        double r403258 = re;
        double r403259 = sin(r403258);
        double r403260 = r403257 * r403259;
        double r403261 = 0.0;
        double r403262 = im;
        double r403263 = r403261 - r403262;
        double r403264 = exp(r403263);
        double r403265 = exp(r403262);
        double r403266 = r403264 + r403265;
        double r403267 = r403260 * r403266;
        return r403267;
}

double f(double re, double im) {
        double r403268 = 0.5;
        double r403269 = im;
        double r403270 = exp(r403269);
        double r403271 = re;
        double r403272 = sin(r403271);
        double r403273 = r403272 / r403270;
        double r403274 = fma(r403270, r403272, r403273);
        double r403275 = r403268 * r403274;
        return r403275;
}

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}{\mathsf{fma}\left(e^{im}, 0.5, \frac{0.5}{e^{im}}\right) \cdot \sin re}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u0.2

    \[\leadsto \mathsf{fma}\left(e^{im}, 0.5, \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{e^{im}}\right)\right)}\right) \cdot \sin re\]
  5. Using strategy rm
  6. Applied log1p-expm1-u0.5

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

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)\right)}\right)\]
  8. Using strategy rm
  9. Applied fma-udef0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\sin re \cdot \color{blue}{\left(0.5 \cdot e^{im} + \frac{0.5}{e^{im}}\right)}\right)\right)\]
  10. Applied distribute-rgt-in0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\left(0.5 \cdot e^{im}\right) \cdot \sin re + \frac{0.5}{e^{im}} \cdot \sin re}\right)\right)\]
  11. Taylor expanded around inf 0.0

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

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

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

Reproduce

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