Average Error: 0.3 → 0.2
Time: 6.7s
Precision: 64
\[\frac{\left(x.re \cdot y.im\right)}{\left(x.im \cdot y.re\right)}\]
\[\left(\mathsf{qma}\left(\left(\left(x.re \cdot y.im\right)\right), x.im, y.re\right)\right)\]
\frac{\left(x.re \cdot y.im\right)}{\left(x.im \cdot y.re\right)}
\left(\mathsf{qma}\left(\left(\left(x.re \cdot y.im\right)\right), x.im, y.re\right)\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1126942 = x_re;
        double r1126943 = y_im;
        double r1126944 = r1126942 * r1126943;
        double r1126945 = x_im;
        double r1126946 = y_re;
        double r1126947 = r1126945 * r1126946;
        double r1126948 = r1126944 + r1126947;
        return r1126948;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1126949 = x_re;
        double r1126950 = y_im;
        double r1126951 = r1126949 * r1126950;
        double r1126952 = /*Error: no posit support in C */;
        double r1126953 = x_im;
        double r1126954 = y_re;
        double r1126955 = /*Error: no posit support in C */;
        double r1126956 = /*Error: no posit support in C */;
        return r1126956;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 0.3

    \[\frac{\left(x.re \cdot y.im\right)}{\left(x.im \cdot y.re\right)}\]
  2. Using strategy rm
  3. Applied introduce-quire0.3

    \[\leadsto \frac{\color{blue}{\left(\left(\left(x.re \cdot y.im\right)\right)\right)}}{\left(x.im \cdot y.re\right)}\]
  4. Applied insert-quire-fdp-add0.2

    \[\leadsto \color{blue}{\left(\mathsf{qma}\left(\left(\left(x.re \cdot y.im\right)\right), x.im, y.re\right)\right)}\]
  5. Final simplification0.2

    \[\leadsto \left(\mathsf{qma}\left(\left(\left(x.re \cdot y.im\right)\right), x.im, y.re\right)\right)\]

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "_multiplyComplex, imaginary part"
  (+.p16 (*.p16 x.re y.im) (*.p16 x.im y.re)))