Average Error: 0.0 → 0.0
Time: 13.9s
Precision: 64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0.0 - im} + e^{im}\right)\]
\[\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(\sqrt{e^{0.0 - im}}, \sqrt{e^{0.0 - im}}, e^{im}\right)\]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0.0 - im} + e^{im}\right)
\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(\sqrt{e^{0.0 - im}}, \sqrt{e^{0.0 - im}}, e^{im}\right)
double f(double re, double im) {
        double r78423 = 0.5;
        double r78424 = re;
        double r78425 = sin(r78424);
        double r78426 = r78423 * r78425;
        double r78427 = 0.0;
        double r78428 = im;
        double r78429 = r78427 - r78428;
        double r78430 = exp(r78429);
        double r78431 = exp(r78428);
        double r78432 = r78430 + r78431;
        double r78433 = r78426 * r78432;
        return r78433;
}

double f(double re, double im) {
        double r78434 = 0.5;
        double r78435 = re;
        double r78436 = sin(r78435);
        double r78437 = r78434 * r78436;
        double r78438 = 0.0;
        double r78439 = im;
        double r78440 = r78438 - r78439;
        double r78441 = exp(r78440);
        double r78442 = sqrt(r78441);
        double r78443 = exp(r78439);
        double r78444 = fma(r78442, r78442, r78443);
        double r78445 = r78437 * r78444;
        return r78445;
}

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.0 - im} + e^{im}\right)\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt0.0

    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\color{blue}{\sqrt{e^{0.0 - im}} \cdot \sqrt{e^{0.0 - im}}} + e^{im}\right)\]
  4. Applied fma-def0.0

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

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

Reproduce

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