Complex division, imag part

?

Percentage Accurate: 62.6% → 85.5%
Time: 10.8s
Precision: binary64
Cost: 14288

?

\[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
\[\begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;d \leq -2.1 \cdot 10^{+160}:\\ \;\;\;\;\frac{\frac{c}{d} \cdot b - a}{d}\\ \mathbf{elif}\;d \leq -4.5 \cdot 10^{-130}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.6 \cdot 10^{-79}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 3.6 \cdot 10^{+37}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (* (/ 1.0 (hypot c d)) (/ (- (* c b) (* d a)) (hypot c d)))))
   (if (<= d -2.1e+160)
     (/ (- (* (/ c d) b) a) d)
     (if (<= d -4.5e-130)
       t_0
       (if (<= d 1.6e-79)
         (/ (- b (* a (/ d c))) c)
         (if (<= d 3.6e+37) t_0 (/ (- (* c (/ b d)) a) d)))))))
double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
double code(double a, double b, double c, double d) {
	double t_0 = (1.0 / hypot(c, d)) * (((c * b) - (d * a)) / hypot(c, d));
	double tmp;
	if (d <= -2.1e+160) {
		tmp = (((c / d) * b) - a) / d;
	} else if (d <= -4.5e-130) {
		tmp = t_0;
	} else if (d <= 1.6e-79) {
		tmp = (b - (a * (d / c))) / c;
	} else if (d <= 3.6e+37) {
		tmp = t_0;
	} else {
		tmp = ((c * (b / d)) - a) / d;
	}
	return tmp;
}
public static double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
public static double code(double a, double b, double c, double d) {
	double t_0 = (1.0 / Math.hypot(c, d)) * (((c * b) - (d * a)) / Math.hypot(c, d));
	double tmp;
	if (d <= -2.1e+160) {
		tmp = (((c / d) * b) - a) / d;
	} else if (d <= -4.5e-130) {
		tmp = t_0;
	} else if (d <= 1.6e-79) {
		tmp = (b - (a * (d / c))) / c;
	} else if (d <= 3.6e+37) {
		tmp = t_0;
	} else {
		tmp = ((c * (b / d)) - a) / d;
	}
	return tmp;
}
def code(a, b, c, d):
	return ((b * c) - (a * d)) / ((c * c) + (d * d))
def code(a, b, c, d):
	t_0 = (1.0 / math.hypot(c, d)) * (((c * b) - (d * a)) / math.hypot(c, d))
	tmp = 0
	if d <= -2.1e+160:
		tmp = (((c / d) * b) - a) / d
	elif d <= -4.5e-130:
		tmp = t_0
	elif d <= 1.6e-79:
		tmp = (b - (a * (d / c))) / c
	elif d <= 3.6e+37:
		tmp = t_0
	else:
		tmp = ((c * (b / d)) - a) / d
	return tmp
function code(a, b, c, d)
	return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function code(a, b, c, d)
	t_0 = Float64(Float64(1.0 / hypot(c, d)) * Float64(Float64(Float64(c * b) - Float64(d * a)) / hypot(c, d)))
	tmp = 0.0
	if (d <= -2.1e+160)
		tmp = Float64(Float64(Float64(Float64(c / d) * b) - a) / d);
	elseif (d <= -4.5e-130)
		tmp = t_0;
	elseif (d <= 1.6e-79)
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c);
	elseif (d <= 3.6e+37)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(c * Float64(b / d)) - a) / d);
	end
	return tmp
end
function tmp = code(a, b, c, d)
	tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
end
function tmp_2 = code(a, b, c, d)
	t_0 = (1.0 / hypot(c, d)) * (((c * b) - (d * a)) / hypot(c, d));
	tmp = 0.0;
	if (d <= -2.1e+160)
		tmp = (((c / d) * b) - a) / d;
	elseif (d <= -4.5e-130)
		tmp = t_0;
	elseif (d <= 1.6e-79)
		tmp = (b - (a * (d / c))) / c;
	elseif (d <= 3.6e+37)
		tmp = t_0;
	else
		tmp = ((c * (b / d)) - a) / d;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.1e+160], N[(N[(N[(N[(c / d), $MachinePrecision] * b), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -4.5e-130], t$95$0, If[LessEqual[d, 1.6e-79], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 3.6e+37], t$95$0, N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]]]]]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;d \leq -2.1 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{c}{d} \cdot b - a}{d}\\

\mathbf{elif}\;d \leq -4.5 \cdot 10^{-130}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;d \leq 1.6 \cdot 10^{-79}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\

\mathbf{elif}\;d \leq 3.6 \cdot 10^{+37}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\


\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 7 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original62.6%
Target99.3%
Herbie85.5%
\[\begin{array}{l} \mathbf{if}\;\left|d\right| < \left|c\right|:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\ \end{array} \]

Derivation?

  1. Split input into 4 regimes
  2. if d < -2.09999999999999997e160

    1. Initial program 21.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in c around 0 84.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{c \cdot b}{{d}^{2}}} \]
    3. Simplified96.9%

      \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}} \]
      Step-by-step derivation

      [Start]84.0%

      \[ -1 \cdot \frac{a}{d} + \frac{c \cdot b}{{d}^{2}} \]

      +-commutative [=>]84.0%

      \[ \color{blue}{\frac{c \cdot b}{{d}^{2}} + -1 \cdot \frac{a}{d}} \]

      mul-1-neg [=>]84.0%

      \[ \frac{c \cdot b}{{d}^{2}} + \color{blue}{\left(-\frac{a}{d}\right)} \]

      unsub-neg [=>]84.0%

      \[ \color{blue}{\frac{c \cdot b}{{d}^{2}} - \frac{a}{d}} \]

      unpow2 [=>]84.0%

      \[ \frac{c \cdot b}{\color{blue}{d \cdot d}} - \frac{a}{d} \]

      times-frac [=>]96.9%

      \[ \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} - \frac{a}{d} \]
    4. Applied egg-rr96.9%

      \[\leadsto \color{blue}{\frac{\frac{c}{d} \cdot b - a}{d}} \]
      Step-by-step derivation

      [Start]96.9%

      \[ \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d} \]

      associate-*r/ [=>]96.9%

      \[ \color{blue}{\frac{\frac{c}{d} \cdot b}{d}} - \frac{a}{d} \]

      sub-div [=>]96.9%

      \[ \color{blue}{\frac{\frac{c}{d} \cdot b - a}{d}} \]

    if -2.09999999999999997e160 < d < -4.5e-130 or 1.59999999999999994e-79 < d < 3.59999999999999998e37

    1. Initial program 77.0%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr86.6%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}} \]
      Step-by-step derivation

      [Start]77.0%

      \[ \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]

      *-un-lft-identity [=>]77.0%

      \[ \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]

      add-sqr-sqrt [=>]77.0%

      \[ \frac{1 \cdot \left(b \cdot c - a \cdot d\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} \]

      times-frac [=>]77.0%

      \[ \color{blue}{\frac{1}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b \cdot c - a \cdot d}{\sqrt{c \cdot c + d \cdot d}}} \]

      hypot-def [=>]77.0%

      \[ \frac{1}{\color{blue}{\mathsf{hypot}\left(c, d\right)}} \cdot \frac{b \cdot c - a \cdot d}{\sqrt{c \cdot c + d \cdot d}} \]

      hypot-def [=>]86.6%

      \[ \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c - a \cdot d}{\color{blue}{\mathsf{hypot}\left(c, d\right)}} \]

    if -4.5e-130 < d < 1.59999999999999994e-79

    1. Initial program 68.9%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr82.9%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}} \]
      Step-by-step derivation

      [Start]68.9%

      \[ \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]

      *-un-lft-identity [=>]68.9%

      \[ \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]

      add-sqr-sqrt [=>]68.9%

      \[ \frac{1 \cdot \left(b \cdot c - a \cdot d\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} \]

      times-frac [=>]68.8%

      \[ \color{blue}{\frac{1}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b \cdot c - a \cdot d}{\sqrt{c \cdot c + d \cdot d}}} \]

      hypot-def [=>]68.8%

      \[ \frac{1}{\color{blue}{\mathsf{hypot}\left(c, d\right)}} \cdot \frac{b \cdot c - a \cdot d}{\sqrt{c \cdot c + d \cdot d}} \]

      hypot-def [=>]82.9%

      \[ \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c - a \cdot d}{\color{blue}{\mathsf{hypot}\left(c, d\right)}} \]
    3. Taylor expanded in c around inf 85.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    4. Simplified94.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{\frac{a}{\frac{c}{d}}}{c}} \]
      Step-by-step derivation

      [Start]85.5%

      \[ -1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c} \]

      +-commutative [=>]85.5%

      \[ \color{blue}{\frac{b}{c} + -1 \cdot \frac{a \cdot d}{{c}^{2}}} \]

      mul-1-neg [=>]85.5%

      \[ \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]

      unsub-neg [=>]85.5%

      \[ \color{blue}{\frac{b}{c} - \frac{a \cdot d}{{c}^{2}}} \]

      unpow2 [=>]85.5%

      \[ \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]

      associate-/r* [=>]93.5%

      \[ \frac{b}{c} - \color{blue}{\frac{\frac{a \cdot d}{c}}{c}} \]

      associate-/l* [=>]94.5%

      \[ \frac{b}{c} - \frac{\color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    5. Applied egg-rr95.6%

      \[\leadsto \color{blue}{1 \cdot \frac{b - \frac{a}{\frac{c}{d}}}{c}} \]
      Step-by-step derivation

      [Start]94.5%

      \[ \frac{b}{c} - \frac{\frac{a}{\frac{c}{d}}}{c} \]

      *-un-lft-identity [=>]94.5%

      \[ \color{blue}{1 \cdot \left(\frac{b}{c} - \frac{\frac{a}{\frac{c}{d}}}{c}\right)} \]

      sub-div [=>]95.6%

      \[ 1 \cdot \color{blue}{\frac{b - \frac{a}{\frac{c}{d}}}{c}} \]
    6. Simplified95.6%

      \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
      Step-by-step derivation

      [Start]95.6%

      \[ 1 \cdot \frac{b - \frac{a}{\frac{c}{d}}}{c} \]

      *-lft-identity [=>]95.6%

      \[ \color{blue}{\frac{b - \frac{a}{\frac{c}{d}}}{c}} \]

      associate-/l* [<=]94.6%

      \[ \frac{b - \color{blue}{\frac{a \cdot d}{c}}}{c} \]

      associate-*r/ [<=]95.6%

      \[ \frac{b - \color{blue}{a \cdot \frac{d}{c}}}{c} \]

    if 3.59999999999999998e37 < d

    1. Initial program 48.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr63.3%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}} \]
      Step-by-step derivation

      [Start]48.7%

      \[ \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]

      *-un-lft-identity [=>]48.7%

      \[ \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]

      add-sqr-sqrt [=>]48.7%

      \[ \frac{1 \cdot \left(b \cdot c - a \cdot d\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} \]

      times-frac [=>]48.7%

      \[ \color{blue}{\frac{1}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b \cdot c - a \cdot d}{\sqrt{c \cdot c + d \cdot d}}} \]

      hypot-def [=>]48.7%

      \[ \frac{1}{\color{blue}{\mathsf{hypot}\left(c, d\right)}} \cdot \frac{b \cdot c - a \cdot d}{\sqrt{c \cdot c + d \cdot d}} \]

      hypot-def [=>]63.3%

      \[ \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c - a \cdot d}{\color{blue}{\mathsf{hypot}\left(c, d\right)}} \]
    3. Taylor expanded in c around 0 84.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{c \cdot b}{{d}^{2}}} \]
    4. Simplified92.2%

      \[\leadsto \color{blue}{\frac{c \cdot \frac{b}{d} - a}{d}} \]
      Step-by-step derivation

      [Start]84.0%

      \[ -1 \cdot \frac{a}{d} + \frac{c \cdot b}{{d}^{2}} \]

      neg-mul-1 [<=]84.0%

      \[ \color{blue}{\left(-\frac{a}{d}\right)} + \frac{c \cdot b}{{d}^{2}} \]

      *-commutative [=>]84.0%

      \[ \left(-\frac{a}{d}\right) + \frac{\color{blue}{b \cdot c}}{{d}^{2}} \]

      unpow2 [=>]84.0%

      \[ \left(-\frac{a}{d}\right) + \frac{b \cdot c}{\color{blue}{d \cdot d}} \]

      times-frac [=>]90.6%

      \[ \left(-\frac{a}{d}\right) + \color{blue}{\frac{b}{d} \cdot \frac{c}{d}} \]

      *-commutative [<=]90.6%

      \[ \left(-\frac{a}{d}\right) + \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} \]

      +-commutative [<=]90.6%

      \[ \color{blue}{\frac{c}{d} \cdot \frac{b}{d} + \left(-\frac{a}{d}\right)} \]

      unsub-neg [=>]90.6%

      \[ \color{blue}{\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}} \]

      associate-*l/ [=>]92.2%

      \[ \color{blue}{\frac{c \cdot \frac{b}{d}}{d}} - \frac{a}{d} \]

      div-sub [<=]92.2%

      \[ \color{blue}{\frac{c \cdot \frac{b}{d} - a}{d}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification92.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.1 \cdot 10^{+160}:\\ \;\;\;\;\frac{\frac{c}{d} \cdot b - a}{d}\\ \mathbf{elif}\;d \leq -4.5 \cdot 10^{-130}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 1.6 \cdot 10^{-79}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 3.6 \cdot 10^{+37}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy85.5%
Cost14288
\[\begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;d \leq -2.1 \cdot 10^{+160}:\\ \;\;\;\;\frac{\frac{c}{d} \cdot b - a}{d}\\ \mathbf{elif}\;d \leq -4.5 \cdot 10^{-130}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.6 \cdot 10^{-79}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 3.6 \cdot 10^{+37}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \end{array} \]
Alternative 2
Accuracy83.1%
Cost1488
\[\begin{array}{l} t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;d \leq -1.65 \cdot 10^{+142}:\\ \;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{d}\\ \mathbf{elif}\;d \leq -1.8 \cdot 10^{-81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{-79}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 6.5 \cdot 10^{+37}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \end{array} \]
Alternative 3
Accuracy71.9%
Cost841
\[\begin{array}{l} \mathbf{if}\;d \leq -2.1 \cdot 10^{+160} \lor \neg \left(d \leq 560000000\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]
Alternative 4
Accuracy77.5%
Cost841
\[\begin{array}{l} \mathbf{if}\;d \leq -9 \cdot 10^{-66} \lor \neg \left(d \leq 2.2 \cdot 10^{-66}\right):\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]
Alternative 5
Accuracy77.3%
Cost840
\[\begin{array}{l} \mathbf{if}\;d \leq -2 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{d}\\ \mathbf{elif}\;d \leq 1.9 \cdot 10^{-67}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \end{array} \]
Alternative 6
Accuracy63.0%
Cost521
\[\begin{array}{l} \mathbf{if}\;d \leq -1.7 \cdot 10^{-66} \lor \neg \left(d \leq 7.2 \cdot 10^{-66}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
Alternative 7
Accuracy42.4%
Cost192
\[\frac{b}{c} \]

Reproduce?

herbie shell --seed 2023272 
(FPCore (a b c d)
  :name "Complex division, imag part"
  :precision binary64

  :herbie-target
  (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d)))))

  (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))