Average Error: 0.0 → 0.0
Time: 4.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 r28824 = 0.5;
        double r28825 = re;
        double r28826 = sin(r28825);
        double r28827 = r28824 * r28826;
        double r28828 = 0.0;
        double r28829 = im;
        double r28830 = r28828 - r28829;
        double r28831 = exp(r28830);
        double r28832 = exp(r28829);
        double r28833 = r28831 + r28832;
        double r28834 = r28827 * r28833;
        return r28834;
}

double f(double re, double im) {
        double r28835 = 0.5;
        double r28836 = re;
        double r28837 = sin(r28836);
        double r28838 = r28835 * r28837;
        double r28839 = 0.0;
        double r28840 = im;
        double r28841 = r28839 - r28840;
        double r28842 = exp(r28841);
        double r28843 = sqrt(r28842);
        double r28844 = exp(r28840);
        double r28845 = fma(r28843, r28843, r28844);
        double r28846 = r28838 * r28845;
        return r28846;
}

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