Average Error: 0.0 → 0.1
Time: 5.4s
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 r30563 = 0.5;
        double r30564 = re;
        double r30565 = sin(r30564);
        double r30566 = r30563 * r30565;
        double r30567 = 0.0;
        double r30568 = im;
        double r30569 = r30567 - r30568;
        double r30570 = exp(r30569);
        double r30571 = exp(r30568);
        double r30572 = r30570 + r30571;
        double r30573 = r30566 * r30572;
        return r30573;
}

double f(double re, double im) {
        double r30574 = 0.5;
        double r30575 = re;
        double r30576 = sin(r30575);
        double r30577 = r30574 * r30576;
        double r30578 = 0.0;
        double r30579 = im;
        double r30580 = r30578 - r30579;
        double r30581 = exp(r30580);
        double r30582 = sqrt(r30581);
        double r30583 = exp(r30579);
        double r30584 = fma(r30582, r30582, r30583);
        double r30585 = r30577 * r30584;
        return r30585;
}

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.1

    \[\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.1

    \[\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.1

    \[\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 2020056 +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))))