Average Error: 25.8 → 13.4
Time: 14.5s
Precision: binary64
Cost: 20624
\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
\[\begin{array}{l} t_0 := \mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)\\ t_1 := x.im \cdot y.re - y.im \cdot x.re\\ \mathbf{if}\;y.im \leq -3.3 \cdot 10^{+128}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -7.8 \cdot 10^{-114}:\\ \;\;\;\;\frac{1}{t_0} \cdot t_1\\ \mathbf{elif}\;y.im \leq 8.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.25 \cdot 10^{-65}:\\ \;\;\;\;t_1 \cdot {\left(\sqrt{t_0}\right)}^{-2}\\ \mathbf{elif}\;y.im \leq 6.4 \cdot 10^{+24}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im}{y.re}}{\frac{y.re}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\ \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (fma y.re y.re (* y.im y.im)))
        (t_1 (- (* x.im y.re) (* y.im x.re))))
   (if (<= y.im -3.3e+128)
     (/ (- (* x.im (/ y.re y.im)) x.re) y.im)
     (if (<= y.im -7.8e-114)
       (* (/ 1.0 t_0) t_1)
       (if (<= y.im 8.6e-97)
         (/ (- x.im (* x.re (/ y.im y.re))) y.re)
         (if (<= y.im 1.25e-65)
           (* t_1 (pow (sqrt t_0) -2.0))
           (if (<= y.im 6.4e+24)
             (- (/ x.im y.re) (/ (/ y.im y.re) (/ y.re x.re)))
             (/ (- (* y.re (/ x.im y.im)) x.re) y.im))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma(y_46_re, y_46_re, (y_46_im * y_46_im));
	double t_1 = (x_46_im * y_46_re) - (y_46_im * x_46_re);
	double tmp;
	if (y_46_im <= -3.3e+128) {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	} else if (y_46_im <= -7.8e-114) {
		tmp = (1.0 / t_0) * t_1;
	} else if (y_46_im <= 8.6e-97) {
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	} else if (y_46_im <= 1.25e-65) {
		tmp = t_1 * pow(sqrt(t_0), -2.0);
	} else if (y_46_im <= 6.4e+24) {
		tmp = (x_46_im / y_46_re) - ((y_46_im / y_46_re) / (y_46_re / x_46_re));
	} else {
		tmp = ((y_46_re * (x_46_im / y_46_im)) - x_46_re) / y_46_im;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
end
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))
	t_1 = Float64(Float64(x_46_im * y_46_re) - Float64(y_46_im * x_46_re))
	tmp = 0.0
	if (y_46_im <= -3.3e+128)
		tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im);
	elseif (y_46_im <= -7.8e-114)
		tmp = Float64(Float64(1.0 / t_0) * t_1);
	elseif (y_46_im <= 8.6e-97)
		tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re);
	elseif (y_46_im <= 1.25e-65)
		tmp = Float64(t_1 * (sqrt(t_0) ^ -2.0));
	elseif (y_46_im <= 6.4e+24)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(Float64(y_46_im / y_46_re) / Float64(y_46_re / x_46_re)));
	else
		tmp = Float64(Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re) / y_46_im);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.3e+128], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -7.8e-114], N[(N[(1.0 / t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 8.6e-97], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.25e-65], N[(t$95$1 * N[Power[N[Sqrt[t$95$0], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 6.4e+24], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(N[(y$46$im / y$46$re), $MachinePrecision] / N[(y$46$re / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]]]]]]]
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)\\
t_1 := x.im \cdot y.re - y.im \cdot x.re\\
\mathbf{if}\;y.im \leq -3.3 \cdot 10^{+128}:\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\

\mathbf{elif}\;y.im \leq -7.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{1}{t_0} \cdot t_1\\

\mathbf{elif}\;y.im \leq 8.6 \cdot 10^{-97}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\

\mathbf{elif}\;y.im \leq 1.25 \cdot 10^{-65}:\\
\;\;\;\;t_1 \cdot {\left(\sqrt{t_0}\right)}^{-2}\\

\mathbf{elif}\;y.im \leq 6.4 \cdot 10^{+24}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im}{y.re}}{\frac{y.re}{x.re}}\\

\mathbf{else}:\\
\;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\


\end{array}

Error

Derivation

  1. Split input into 6 regimes
  2. if y.im < -3.3000000000000001e128

    1. Initial program 42.0

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around 0 15.1

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{y.re \cdot x.im}{{y.im}^{2}}} \]
    3. Simplified14.0

      \[\leadsto \color{blue}{\frac{x.im}{\frac{y.im \cdot y.im}{y.re}} - \frac{x.re}{y.im}} \]
      Proof

      [Start]15.1

      \[ -1 \cdot \frac{x.re}{y.im} + \frac{y.re \cdot x.im}{{y.im}^{2}} \]

      +-commutative [=>]15.1

      \[ \color{blue}{\frac{y.re \cdot x.im}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]

      mul-1-neg [=>]15.1

      \[ \frac{y.re \cdot x.im}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]

      unsub-neg [=>]15.1

      \[ \color{blue}{\frac{y.re \cdot x.im}{{y.im}^{2}} - \frac{x.re}{y.im}} \]

      *-commutative [=>]15.1

      \[ \frac{\color{blue}{x.im \cdot y.re}}{{y.im}^{2}} - \frac{x.re}{y.im} \]

      unpow2 [=>]15.1

      \[ \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]

      associate-/l* [=>]14.0

      \[ \color{blue}{\frac{x.im}{\frac{y.im \cdot y.im}{y.re}}} - \frac{x.re}{y.im} \]
    4. Applied egg-rr12.3

      \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{y.re} \cdot y.im}} - \frac{x.re}{y.im} \]
    5. Taylor expanded in x.im around 0 15.1

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{y.re \cdot x.im}{{y.im}^{2}}} \]
    6. Simplified8.7

      \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}} \]
      Proof

      [Start]15.1

      \[ -1 \cdot \frac{x.re}{y.im} + \frac{y.re \cdot x.im}{{y.im}^{2}} \]

      mul-1-neg [=>]15.1

      \[ \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{y.re \cdot x.im}{{y.im}^{2}} \]

      unpow2 [=>]15.1

      \[ \left(-\frac{x.re}{y.im}\right) + \frac{y.re \cdot x.im}{\color{blue}{y.im \cdot y.im}} \]

      associate-/r* [=>]12.3

      \[ \left(-\frac{x.re}{y.im}\right) + \color{blue}{\frac{\frac{y.re \cdot x.im}{y.im}}{y.im}} \]

      associate-*r/ [<=]8.3

      \[ \left(-\frac{x.re}{y.im}\right) + \frac{\color{blue}{y.re \cdot \frac{x.im}{y.im}}}{y.im} \]

      *-commutative [=>]8.3

      \[ \left(-\frac{x.re}{y.im}\right) + \frac{\color{blue}{\frac{x.im}{y.im} \cdot y.re}}{y.im} \]

      associate-/r/ [<=]8.7

      \[ \left(-\frac{x.re}{y.im}\right) + \frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}}}}{y.im} \]

      +-commutative [=>]8.7

      \[ \color{blue}{\frac{\frac{x.im}{\frac{y.im}{y.re}}}{y.im} + \left(-\frac{x.re}{y.im}\right)} \]

      sub-neg [<=]8.7

      \[ \color{blue}{\frac{\frac{x.im}{\frac{y.im}{y.re}}}{y.im} - \frac{x.re}{y.im}} \]

      div-sub [<=]8.7

      \[ \color{blue}{\frac{\frac{x.im}{\frac{y.im}{y.re}} - x.re}{y.im}} \]

      associate-/r/ [=>]8.3

      \[ \frac{\color{blue}{\frac{x.im}{y.im} \cdot y.re} - x.re}{y.im} \]

      associate-*l/ [=>]12.3

      \[ \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]

      associate-*r/ [<=]8.7

      \[ \frac{\color{blue}{x.im \cdot \frac{y.re}{y.im}} - x.re}{y.im} \]

    if -3.3000000000000001e128 < y.im < -7.80000000000000003e-114

    1. Initial program 17.2

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Applied egg-rr17.2

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)} \]

    if -7.80000000000000003e-114 < y.im < 8.6e-97

    1. Initial program 21.7

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Applied egg-rr22.2

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)} \]
    3. Taylor expanded in y.re around inf 11.5

      \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
    4. Simplified10.2

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{y.im}{y.re} \cdot \frac{x.re}{y.re}} \]
      Proof

      [Start]11.5

      \[ \frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} \]

      mul-1-neg [=>]11.5

      \[ \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]

      unsub-neg [=>]11.5

      \[ \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]

      *-commutative [=>]11.5

      \[ \frac{x.im}{y.re} - \frac{\color{blue}{y.im \cdot x.re}}{{y.re}^{2}} \]

      unpow2 [=>]11.5

      \[ \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]

      times-frac [=>]10.2

      \[ \frac{x.im}{y.re} - \color{blue}{\frac{y.im}{y.re} \cdot \frac{x.re}{y.re}} \]
    5. Applied egg-rr8.2

      \[\leadsto \color{blue}{\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}} \]

    if 8.6e-97 < y.im < 1.24999999999999996e-65

    1. Initial program 14.5

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Applied egg-rr14.5

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)} \]
    3. Applied egg-rr14.7

      \[\leadsto \color{blue}{\left({\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{-1} \cdot {\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{-1}\right)} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right) \]
    4. Simplified14.5

      \[\leadsto \color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{-2}} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right) \]
      Proof

      [Start]14.7

      \[ \left({\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{-1} \cdot {\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{-1}\right) \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right) \]

      pow-sqr [=>]14.5

      \[ \color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{\left(2 \cdot -1\right)}} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right) \]

      metadata-eval [=>]14.5

      \[ {\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{\color{blue}{-2}} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right) \]

    if 1.24999999999999996e-65 < y.im < 6.3999999999999995e24

    1. Initial program 14.3

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Applied egg-rr14.4

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)} \]
    3. Taylor expanded in y.re around inf 30.4

      \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
    4. Simplified28.8

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{y.im}{y.re} \cdot \frac{x.re}{y.re}} \]
      Proof

      [Start]30.4

      \[ \frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} \]

      mul-1-neg [=>]30.4

      \[ \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]

      unsub-neg [=>]30.4

      \[ \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]

      *-commutative [=>]30.4

      \[ \frac{x.im}{y.re} - \frac{\color{blue}{y.im \cdot x.re}}{{y.re}^{2}} \]

      unpow2 [=>]30.4

      \[ \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]

      times-frac [=>]28.8

      \[ \frac{x.im}{y.re} - \color{blue}{\frac{y.im}{y.re} \cdot \frac{x.re}{y.re}} \]
    5. Applied egg-rr28.8

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{\frac{y.im}{y.re}}{\frac{y.re}{x.re}}} \]

    if 6.3999999999999995e24 < y.im

    1. Initial program 33.2

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around 0 20.0

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{y.re \cdot x.im}{{y.im}^{2}}} \]
    3. Simplified19.4

      \[\leadsto \color{blue}{\frac{x.im}{\frac{y.im \cdot y.im}{y.re}} - \frac{x.re}{y.im}} \]
      Proof

      [Start]20.0

      \[ -1 \cdot \frac{x.re}{y.im} + \frac{y.re \cdot x.im}{{y.im}^{2}} \]

      +-commutative [=>]20.0

      \[ \color{blue}{\frac{y.re \cdot x.im}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]

      mul-1-neg [=>]20.0

      \[ \frac{y.re \cdot x.im}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]

      unsub-neg [=>]20.0

      \[ \color{blue}{\frac{y.re \cdot x.im}{{y.im}^{2}} - \frac{x.re}{y.im}} \]

      *-commutative [=>]20.0

      \[ \frac{\color{blue}{x.im \cdot y.re}}{{y.im}^{2}} - \frac{x.re}{y.im} \]

      unpow2 [=>]20.0

      \[ \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]

      associate-/l* [=>]19.4

      \[ \color{blue}{\frac{x.im}{\frac{y.im \cdot y.im}{y.re}}} - \frac{x.re}{y.im} \]
    4. Applied egg-rr18.1

      \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{y.re} \cdot y.im}} - \frac{x.re}{y.im} \]
    5. Applied egg-rr15.4

      \[\leadsto \color{blue}{\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)} \]
    6. Applied egg-rr14.5

      \[\leadsto \color{blue}{\frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification13.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -3.3 \cdot 10^{+128}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -7.8 \cdot 10^{-114}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \left(x.im \cdot y.re - y.im \cdot x.re\right)\\ \mathbf{elif}\;y.im \leq 8.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.25 \cdot 10^{-65}:\\ \;\;\;\;\left(x.im \cdot y.re - y.im \cdot x.re\right) \cdot {\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{-2}\\ \mathbf{elif}\;y.im \leq 6.4 \cdot 10^{+24}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im}{y.re}}{\frac{y.re}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\ \end{array} \]

Alternatives

Alternative 1
Error13.4
Cost7624
\[\begin{array}{l} t_0 := x.im \cdot y.re - y.im \cdot x.re\\ \mathbf{if}\;y.im \leq -9.4 \cdot 10^{+126}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.1 \cdot 10^{-113}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot t_0\\ \mathbf{elif}\;y.im \leq 4.9 \cdot 10^{-90}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.1 \cdot 10^{-64}:\\ \;\;\;\;\frac{t_0}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.im \leq 7 \cdot 10^{+24}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im}{y.re}}{\frac{y.re}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\ \end{array} \]
Alternative 2
Error13.4
Cost1488
\[\begin{array}{l} t_0 := \frac{x.im \cdot y.re - y.im \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{if}\;y.im \leq -8.2 \cdot 10^{+126}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -4.4 \cdot 10^{-113}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 1.2 \cdot 10^{-89}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.18 \cdot 10^{-63}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 6.2 \cdot 10^{+25}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{y.im}{y.re}}{\frac{y.re}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\ \end{array} \]
Alternative 3
Error15.8
Cost1106
\[\begin{array}{l} \mathbf{if}\;y.im \leq -2.7 \cdot 10^{+59} \lor \neg \left(y.im \leq -2.8 \cdot 10^{-60} \lor \neg \left(y.im \leq -7.6 \cdot 10^{-84}\right) \land y.im \leq 2.1 \cdot 10^{+21}\right):\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \end{array} \]
Alternative 4
Error15.5
Cost1104
\[\begin{array}{l} t_0 := \frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ t_1 := \frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\ \mathbf{if}\;y.im \leq -2.5 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq -2.8 \cdot 10^{-60}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq -7.6 \cdot 10^{-84}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 5.9 \cdot 10^{+22}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error15.5
Cost1104
\[\begin{array}{l} t_0 := \frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\ \mathbf{if}\;y.im \leq -1.15 \cdot 10^{+59}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq -3.5 \cdot 10^{-60}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{y.im}{y.re} \cdot \frac{x.re}{y.re}\\ \mathbf{elif}\;y.im \leq -7.6 \cdot 10^{-84}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+23}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error15.7
Cost1104
\[\begin{array}{l} \mathbf{if}\;y.im \leq -1.15 \cdot 10^{+59}:\\ \;\;\;\;\frac{y.re}{\frac{y.im}{\frac{x.im}{y.im}}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -4.2 \cdot 10^{-60}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{y.im}{y.re} \cdot \frac{x.re}{y.re}\\ \mathbf{elif}\;y.im \leq -5.4 \cdot 10^{-86}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+21}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{y.im} - x.re}{y.im}\\ \end{array} \]
Alternative 7
Error18.4
Cost841
\[\begin{array}{l} \mathbf{if}\;y.im \leq -1.4 \cdot 10^{+59} \lor \neg \left(y.im \leq 3.8 \cdot 10^{+24}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \end{array} \]
Alternative 8
Error24.7
Cost521
\[\begin{array}{l} \mathbf{if}\;y.im \leq -7.2 \cdot 10^{-113} \lor \neg \left(y.im \leq 6.2 \cdot 10^{+42}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
Alternative 9
Error34.2
Cost456
\[\begin{array}{l} \mathbf{if}\;y.im \leq -6.5 \cdot 10^{+157}:\\ \;\;\;\;\frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 5.4 \cdot 10^{+144}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.re}{y.im}\\ \end{array} \]
Alternative 10
Error36.9
Cost192
\[\frac{x.im}{y.re} \]

Error

Reproduce

herbie shell --seed 2023010 
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, imaginary part"
  :precision binary64
  (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))