Average Error: 1.1 → 1.0
Time: 17.8s
Precision: 64
\[\frac{\left(\left(x.im \cdot y.re\right) - \left(x.re \cdot y.im\right)\right)}{\left(\frac{\left(y.re \cdot y.re\right)}{\left(y.im \cdot y.im\right)}\right)}\]
\[\frac{\left(\mathsf{qms}\left(\left(\left(x.im \cdot y.re\right)\right), x.re, y.im\right)\right)}{\left(\mathsf{qma}\left(\left(\left(y.re \cdot y.re\right)\right), y.im, y.im\right)\right)}\]
\frac{\left(\left(x.im \cdot y.re\right) - \left(x.re \cdot y.im\right)\right)}{\left(\frac{\left(y.re \cdot y.re\right)}{\left(y.im \cdot y.im\right)}\right)}
\frac{\left(\mathsf{qms}\left(\left(\left(x.im \cdot y.re\right)\right), x.re, y.im\right)\right)}{\left(\mathsf{qma}\left(\left(\left(y.re \cdot y.re\right)\right), y.im, y.im\right)\right)}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r624023 = x_im;
        double r624024 = y_re;
        double r624025 = r624023 * r624024;
        double r624026 = x_re;
        double r624027 = y_im;
        double r624028 = r624026 * r624027;
        double r624029 = r624025 - r624028;
        double r624030 = r624024 * r624024;
        double r624031 = r624027 * r624027;
        double r624032 = r624030 + r624031;
        double r624033 = r624029 / r624032;
        return r624033;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r624034 = x_im;
        double r624035 = y_re;
        double r624036 = r624034 * r624035;
        double r624037 = /*Error: no posit support in C */;
        double r624038 = x_re;
        double r624039 = y_im;
        double r624040 = /*Error: no posit support in C */;
        double r624041 = /*Error: no posit support in C */;
        double r624042 = r624035 * r624035;
        double r624043 = /*Error: no posit support in C */;
        double r624044 = /*Error: no posit support in C */;
        double r624045 = /*Error: no posit support in C */;
        double r624046 = r624041 / r624045;
        return r624046;
}

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 1.1

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

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

    \[\leadsto \frac{\left(\left(x.im \cdot y.re\right) - \left(x.re \cdot y.im\right)\right)}{\color{blue}{\left(\left(\mathsf{qma}\left(\left(\left(y.re \cdot y.re\right)\right), y.im, y.im\right)\right)\right)}}\]
  5. Using strategy rm
  6. Applied introduce-quire1.1

    \[\leadsto \frac{\left(\color{blue}{\left(\left(\left(x.im \cdot y.re\right)\right)\right)} - \left(x.re \cdot y.im\right)\right)}{\left(\left(\mathsf{qma}\left(\left(\left(y.re \cdot y.re\right)\right), y.im, y.im\right)\right)\right)}\]
  7. Applied insert-quire-fdp-sub1.0

    \[\leadsto \frac{\color{blue}{\left(\left(\mathsf{qms}\left(\left(\left(x.im \cdot y.re\right)\right), x.re, y.im\right)\right)\right)}}{\left(\left(\mathsf{qma}\left(\left(\left(y.re \cdot y.re\right)\right), y.im, y.im\right)\right)\right)}\]
  8. Final simplification1.0

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

Reproduce

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