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 r78957 = 0.5;
        double r78958 = re;
        double r78959 = sin(r78958);
        double r78960 = r78957 * r78959;
        double r78961 = 0.0;
        double r78962 = im;
        double r78963 = r78961 - r78962;
        double r78964 = exp(r78963);
        double r78965 = exp(r78962);
        double r78966 = r78964 + r78965;
        double r78967 = r78960 * r78966;
        return r78967;
}

double f(double re, double im) {
        double r78968 = 0.5;
        double r78969 = re;
        double r78970 = sin(r78969);
        double r78971 = r78968 * r78970;
        double r78972 = 0.0;
        double r78973 = im;
        double r78974 = r78972 - r78973;
        double r78975 = exp(r78974);
        double r78976 = sqrt(r78975);
        double r78977 = exp(r78973);
        double r78978 = fma(r78976, r78976, r78977);
        double r78979 = r78971 * r78978;
        return r78979;
}

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