Average Error: 1.1 → 1.0
Time: 2.3m
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(\left(x.im \cdot y.re\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)}\]
\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(\left(x.im \cdot y.re\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)}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r2954024 = x_im;
        double r2954025 = y_re;
        double r2954026 = r2954024 * r2954025;
        double r2954027 = x_re;
        double r2954028 = y_im;
        double r2954029 = r2954027 * r2954028;
        double r2954030 = r2954026 - r2954029;
        double r2954031 = r2954025 * r2954025;
        double r2954032 = r2954028 * r2954028;
        double r2954033 = r2954031 + r2954032;
        double r2954034 = r2954030 / r2954033;
        return r2954034;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r2954035 = x_im;
        double r2954036 = y_re;
        double r2954037 = r2954035 * r2954036;
        double r2954038 = x_re;
        double r2954039 = y_im;
        double r2954040 = r2954038 * r2954039;
        double r2954041 = r2954037 - r2954040;
        double r2954042 = r2954036 * r2954036;
        double r2954043 = /*Error: no posit support in C */;
        double r2954044 = /*Error: no posit support in C */;
        double r2954045 = /*Error: no posit support in C */;
        double r2954046 = r2954041 / r2954045;
        return r2954046;
}

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.0

    \[\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. Final simplification1.0

    \[\leadsto \frac{\left(\left(x.im \cdot y.re\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)}\]

Reproduce

herbie shell --seed 2019168 
(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))))