Average Error: 0.0 → 0.0
Time: 5.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 r34202 = 0.5;
        double r34203 = re;
        double r34204 = sin(r34203);
        double r34205 = r34202 * r34204;
        double r34206 = 0.0;
        double r34207 = im;
        double r34208 = r34206 - r34207;
        double r34209 = exp(r34208);
        double r34210 = exp(r34207);
        double r34211 = r34209 + r34210;
        double r34212 = r34205 * r34211;
        return r34212;
}

double f(double re, double im) {
        double r34213 = 0.5;
        double r34214 = re;
        double r34215 = sin(r34214);
        double r34216 = r34213 * r34215;
        double r34217 = 0.0;
        double r34218 = im;
        double r34219 = r34217 - r34218;
        double r34220 = exp(r34219);
        double r34221 = sqrt(r34220);
        double r34222 = exp(r34218);
        double r34223 = fma(r34221, r34221, r34222);
        double r34224 = r34216 * r34223;
        return r34224;
}

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 2020060 +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))))