Average Error: 0.3 → 0.2
Time: 5.9s
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 r940635 = x_re;
        double r940636 = y_im;
        double r940637 = r940635 * r940636;
        double r940638 = x_im;
        double r940639 = y_re;
        double r940640 = r940638 * r940639;
        double r940641 = r940637 + r940640;
        return r940641;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r940642 = x_re;
        double r940643 = y_im;
        double r940644 = r940642 * r940643;
        double r940645 = /*Error: no posit support in C */;
        double r940646 = x_im;
        double r940647 = y_re;
        double r940648 = /*Error: no posit support in C */;
        double r940649 = /*Error: no posit support in C */;
        return r940649;
}

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