Average Error: 0.3 → 0.2
Time: 6.3s
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 r735539 = x_re;
        double r735540 = y_im;
        double r735541 = r735539 * r735540;
        double r735542 = x_im;
        double r735543 = y_re;
        double r735544 = r735542 * r735543;
        double r735545 = r735541 + r735544;
        return r735545;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r735546 = x_re;
        double r735547 = y_im;
        double r735548 = r735546 * r735547;
        double r735549 = /*Error: no posit support in C */;
        double r735550 = x_im;
        double r735551 = y_re;
        double r735552 = /*Error: no posit support in C */;
        double r735553 = /*Error: no posit support in C */;
        return r735553;
}

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