Average Error: 0.0 → 0.1
Time: 5.6s
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 r31227 = 0.5;
        double r31228 = re;
        double r31229 = sin(r31228);
        double r31230 = r31227 * r31229;
        double r31231 = 0.0;
        double r31232 = im;
        double r31233 = r31231 - r31232;
        double r31234 = exp(r31233);
        double r31235 = exp(r31232);
        double r31236 = r31234 + r31235;
        double r31237 = r31230 * r31236;
        return r31237;
}

double f(double re, double im) {
        double r31238 = 0.5;
        double r31239 = re;
        double r31240 = sin(r31239);
        double r31241 = r31238 * r31240;
        double r31242 = 0.0;
        double r31243 = im;
        double r31244 = r31242 - r31243;
        double r31245 = exp(r31244);
        double r31246 = sqrt(r31245);
        double r31247 = exp(r31243);
        double r31248 = fma(r31246, r31246, r31247);
        double r31249 = r31241 * r31248;
        return r31249;
}

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