Average Error: 26.4 → 7.7
Time: 15.8s
Precision: binary64
Cost: 33552
\[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
\[\begin{array}{l} t_0 := -d \cdot a\\ t_1 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\ t_2 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;d \leq -1.5 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{fma}\left(t_1, t_2, \frac{-a}{d}\right)\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{-197}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(c, b, t_0\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 8.5 \cdot 10^{-179}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+67}:\\ \;\;\;\;\mathsf{fma}\left(t_1, t_2, \frac{t_0}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{\mathsf{hypot}\left(c, d\right)}\\ \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 (- (* d a))) (t_1 (/ c (hypot c d))) (t_2 (/ b (hypot c d))))
   (if (<= d -1.5e+98)
     (fma t_1 t_2 (/ (- a) d))
     (if (<= d -1.22e-197)
       (/ (/ (fma c b t_0) (hypot c d)) (hypot c d))
       (if (<= d 8.5e-179)
         (/ (- b (* a (/ d c))) c)
         (if (<= d 2.6e+67)
           (fma t_1 t_2 (/ t_0 (pow (hypot c d) 2.0)))
           (/ (- (/ c (/ d b)) a) (hypot c 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 = -(d * a);
	double t_1 = c / hypot(c, d);
	double t_2 = b / hypot(c, d);
	double tmp;
	if (d <= -1.5e+98) {
		tmp = fma(t_1, t_2, (-a / d));
	} else if (d <= -1.22e-197) {
		tmp = (fma(c, b, t_0) / hypot(c, d)) / hypot(c, d);
	} else if (d <= 8.5e-179) {
		tmp = (b - (a * (d / c))) / c;
	} else if (d <= 2.6e+67) {
		tmp = fma(t_1, t_2, (t_0 / pow(hypot(c, d), 2.0)));
	} else {
		tmp = ((c / (d / b)) - a) / hypot(c, 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(d * a))
	t_1 = Float64(c / hypot(c, d))
	t_2 = Float64(b / hypot(c, d))
	tmp = 0.0
	if (d <= -1.5e+98)
		tmp = fma(t_1, t_2, Float64(Float64(-a) / d));
	elseif (d <= -1.22e-197)
		tmp = Float64(Float64(fma(c, b, t_0) / hypot(c, d)) / hypot(c, d));
	elseif (d <= 8.5e-179)
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c);
	elseif (d <= 2.6e+67)
		tmp = fma(t_1, t_2, Float64(t_0 / (hypot(c, d) ^ 2.0)));
	else
		tmp = Float64(Float64(Float64(c / Float64(d / b)) - a) / hypot(c, d));
	end
	return 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[(d * a), $MachinePrecision])}, Block[{t$95$1 = N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.5e+98], N[(t$95$1 * t$95$2 + N[((-a) / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.22e-197], N[(N[(N[(c * b + t$95$0), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.5e-179], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.6e+67], N[(t$95$1 * t$95$2 + N[(t$95$0 / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c / N[(d / b), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\begin{array}{l}
t_0 := -d \cdot a\\
t_1 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\
t_2 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;d \leq -1.5 \cdot 10^{+98}:\\
\;\;\;\;\mathsf{fma}\left(t_1, t_2, \frac{-a}{d}\right)\\

\mathbf{elif}\;d \leq -1.22 \cdot 10^{-197}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(c, b, t_0\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\

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

\mathbf{elif}\;d \leq 2.6 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(t_1, t_2, \frac{t_0}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{\mathsf{hypot}\left(c, d\right)}\\


\end{array}

Error

Target

Original26.4
Target0.4
Herbie7.7
\[\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 5 regimes
  2. if d < -1.5000000000000001e98

    1. Initial program 39.6

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a \cdot d}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)} \]
    3. Taylor expanded in d around inf 6.3

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

    if -1.5000000000000001e98 < d < -1.22e-197

    1. Initial program 17.1

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

      \[\leadsto \color{blue}{{\left(\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{b \cdot c - a \cdot d}\right)}^{-1}} \]
    3. Applied egg-rr11.2

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

    if -1.22e-197 < d < 8.49999999999999932e-179

    1. Initial program 24.7

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in c around inf 8.9

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

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{\frac{c \cdot c}{d}}} \]
      Proof
      (-.f64 (/.f64 b c) (/.f64 a (/.f64 (*.f64 c c) d))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 b c) (/.f64 a (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) d))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 b c) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 a d) (pow.f64 c 2)))): 24 points increase in error, 10 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 b c) (neg.f64 (/.f64 (*.f64 a d) (pow.f64 c 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 b c) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 (*.f64 a d) (pow.f64 c 2))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 (/.f64 (*.f64 a d) (pow.f64 c 2))) (/.f64 b c))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr6.5

      \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    5. Taylor expanded in b around 0 8.9

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

      \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
      Proof
      (/.f64 (-.f64 b (*.f64 a (/.f64 d c))) c): 0 points increase in error, 0 points decrease in error
      (Rewrite=> div-sub_binary64 (-.f64 (/.f64 b c) (/.f64 (*.f64 a (/.f64 d c)) c))): 0 points increase in error, 1 points decrease in error
      (-.f64 (/.f64 b c) (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 a c) (/.f64 d c)))): 13 points increase in error, 18 points decrease in error
      (-.f64 (/.f64 b c) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 a d) (*.f64 c c)))): 45 points increase in error, 13 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 b c) (neg.f64 (/.f64 (*.f64 a d) (*.f64 c c))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 b c) (neg.f64 (/.f64 (*.f64 a d) (Rewrite<= unpow2_binary64 (pow.f64 c 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 b c) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 (*.f64 a d) (pow.f64 c 2))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 (/.f64 (*.f64 a d) (pow.f64 c 2))) (/.f64 b c))): 0 points increase in error, 0 points decrease in error

    if 8.49999999999999932e-179 < d < 2.6e67

    1. Initial program 14.9

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr4.8

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

    if 2.6e67 < d

    1. Initial program 37.4

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

      \[\leadsto \color{blue}{{\left(\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{b \cdot c - a \cdot d}\right)}^{-1}} \]
    3. Applied egg-rr25.1

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(c, b, d \cdot \left(-a\right)\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}} \]
    4. Taylor expanded in c around 0 14.3

      \[\leadsto \frac{\color{blue}{\frac{c \cdot b}{d} + -1 \cdot a}}{\mathsf{hypot}\left(c, d\right)} \]
    5. Simplified11.0

      \[\leadsto \frac{\color{blue}{\left(-a\right) + \frac{c}{\frac{d}{b}}}}{\mathsf{hypot}\left(c, d\right)} \]
      Proof
      (+.f64 (neg.f64 a) (/.f64 c (/.f64 d b))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 a)) (/.f64 c (/.f64 d b))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -1 a) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c b) d))): 22 points increase in error, 17 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 (*.f64 c b) d) (*.f64 -1 a))): 0 points increase in error, 0 points decrease in error
  3. Recombined 5 regimes into one program.
  4. Final simplification7.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.5 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{d}\right)\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{-197}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(c, b, -d \cdot a\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 8.5 \cdot 10^{-179}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+67}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-d \cdot a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]

Alternatives

Alternative 1
Error12.6
Cost20232
\[\begin{array}{l} t_0 := \frac{c}{\frac{d}{b}}\\ \mathbf{if}\;d \leq -2.05 \cdot 10^{+153}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1, t_0, a\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq -1.2 \cdot 10^{-191}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(c, b, -d \cdot a\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 2 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 - a}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 2
Error11.6
Cost20232
\[\begin{array}{l} \mathbf{if}\;d \leq -4.5 \cdot 10^{+97}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{d}\right)\\ \mathbf{elif}\;d \leq -1.18 \cdot 10^{-191}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(c, b, -d \cdot a\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 3
Error12.5
Cost14024
\[\begin{array}{l} t_0 := \frac{c}{\frac{d}{b}}\\ \mathbf{if}\;d \leq -1.25 \cdot 10^{+148}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1, t_0, a\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq -2.75 \cdot 10^{-192}:\\ \;\;\;\;\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.15 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 - a}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 4
Error13.1
Cost13768
\[\begin{array}{l} t_0 := \frac{c}{\frac{d}{b}}\\ \mathbf{if}\;d \leq -3.8 \cdot 10^{+97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1, t_0, a\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq -5.5 \cdot 10^{-129}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 - a}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 5
Error13.0
Cost13572
\[\begin{array}{l} t_0 := \frac{c}{\frac{d}{b}}\\ \mathbf{if}\;d \leq -2.6 \cdot 10^{+98}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1, t_0, a\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq -1.4 \cdot 10^{-133}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 - a}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 6
Error13.2
Cost7436
\[\begin{array}{l} \mathbf{if}\;d \leq -2.4 \cdot 10^{+99}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{elif}\;d \leq -2.6 \cdot 10^{-137}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 7
Error13.4
Cost1224
\[\begin{array}{l} t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{if}\;d \leq -7 \cdot 10^{+97}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-136}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error16.3
Cost1100
\[\begin{array}{l} t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{if}\;d \leq -1.12 \cdot 10^{+94}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -2.9 \cdot 10^{-128}:\\ \;\;\;\;\frac{-d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error15.6
Cost968
\[\begin{array}{l} t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{if}\;d \leq -8.5 \cdot 10^{+52}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.16 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Error18.4
Cost840
\[\begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -2.6 \cdot 10^{+53}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{+58}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error22.9
Cost520
\[\begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -1.92 \cdot 10^{-75}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+55}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 12
Error35.1
Cost456
\[\begin{array}{l} \mathbf{if}\;d \leq -2.8 \cdot 10^{+226}:\\ \;\;\;\;\frac{a}{d}\\ \mathbf{elif}\;d \leq 2.8 \cdot 10^{+192}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{d}\\ \end{array} \]
Alternative 13
Error56.9
Cost192
\[\frac{a}{d} \]

Error

Reproduce

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