Average Error: 26.6 → 7.5
Time: 19.7s
Precision: binary64
Cost: 33552
\[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
\[\begin{array}{l} t_0 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\ t_1 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\ t_2 := \mathsf{fma}\left(t_0, t_1, \frac{-a}{d}\right)\\ \mathbf{if}\;d \leq -1.1469635874565826 \cdot 10^{+68}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-230}:\\ \;\;\;\;\frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 10^{-192}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{d \cdot a}{c} - b\right)\\ \mathbf{elif}\;d \leq 5.673336263870845 \cdot 10^{+150}:\\ \;\;\;\;\mathsf{fma}\left(t_0, t_1, \frac{d \cdot \left(-a\right)}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \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 (/ c (hypot c d)))
        (t_1 (/ b (hypot c d)))
        (t_2 (fma t_0 t_1 (/ (- a) d))))
   (if (<= d -1.1469635874565826e+68)
     t_2
     (if (<= d -1e-230)
       (/ (/ (- (* c b) (* d a)) (hypot c d)) (hypot c d))
       (if (<= d 1e-192)
         (* (/ -1.0 c) (- (/ (* d a) c) b))
         (if (<= d 5.673336263870845e+150)
           (fma t_0 t_1 (/ (* d (- a)) (pow (hypot c d) 2.0)))
           t_2))))))
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 = c / hypot(c, d);
	double t_1 = b / hypot(c, d);
	double t_2 = fma(t_0, t_1, (-a / d));
	double tmp;
	if (d <= -1.1469635874565826e+68) {
		tmp = t_2;
	} else if (d <= -1e-230) {
		tmp = (((c * b) - (d * a)) / hypot(c, d)) / hypot(c, d);
	} else if (d <= 1e-192) {
		tmp = (-1.0 / c) * (((d * a) / c) - b);
	} else if (d <= 5.673336263870845e+150) {
		tmp = fma(t_0, t_1, ((d * -a) / pow(hypot(c, d), 2.0)));
	} else {
		tmp = t_2;
	}
	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(c / hypot(c, d))
	t_1 = Float64(b / hypot(c, d))
	t_2 = fma(t_0, t_1, Float64(Float64(-a) / d))
	tmp = 0.0
	if (d <= -1.1469635874565826e+68)
		tmp = t_2;
	elseif (d <= -1e-230)
		tmp = Float64(Float64(Float64(Float64(c * b) - Float64(d * a)) / hypot(c, d)) / hypot(c, d));
	elseif (d <= 1e-192)
		tmp = Float64(Float64(-1.0 / c) * Float64(Float64(Float64(d * a) / c) - b));
	elseif (d <= 5.673336263870845e+150)
		tmp = fma(t_0, t_1, Float64(Float64(d * Float64(-a)) / (hypot(c, d) ^ 2.0)));
	else
		tmp = t_2;
	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[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1 + N[((-a) / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.1469635874565826e+68], t$95$2, If[LessEqual[d, -1e-230], N[(N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1e-192], N[(N[(-1.0 / c), $MachinePrecision] * N[(N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.673336263870845e+150], N[(t$95$0 * t$95$1 + N[(N[(d * (-a)), $MachinePrecision] / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\begin{array}{l}
t_0 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
t_2 := \mathsf{fma}\left(t_0, t_1, \frac{-a}{d}\right)\\
\mathbf{if}\;d \leq -1.1469635874565826 \cdot 10^{+68}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;d \leq -1 \cdot 10^{-230}:\\
\;\;\;\;\frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\

\mathbf{elif}\;d \leq 10^{-192}:\\
\;\;\;\;\frac{-1}{c} \cdot \left(\frac{d \cdot a}{c} - b\right)\\

\mathbf{elif}\;d \leq 5.673336263870845 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(t_0, t_1, \frac{d \cdot \left(-a\right)}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}

Error

Target

Original26.6
Target0.4
Herbie7.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 < -1.14696358745658257e68 or 5.67333626387084466e150 < d

    1. Initial program 40.0

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

      \[\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 5.8

      \[\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.14696358745658257e68 < d < -1.00000000000000005e-230

    1. Initial program 17.4

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

      \[\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)}} \]
    3. Applied egg-rr10.4

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

    if -1.00000000000000005e-230 < d < 1.0000000000000001e-192

    1. Initial program 24.8

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

      \[\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)}} \]
    3. Taylor expanded in c around -inf 29.2

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

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

    if 1.0000000000000001e-192 < d < 5.67333626387084466e150

    1. Initial program 19.0

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr8.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. Recombined 4 regimes into one program.
  4. Final simplification7.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.1469635874565826 \cdot 10^{+68}:\\ \;\;\;\;\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 \cdot 10^{-230}:\\ \;\;\;\;\frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 10^{-192}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{d \cdot a}{c} - b\right)\\ \mathbf{elif}\;d \leq 5.673336263870845 \cdot 10^{+150}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{d \cdot \left(-a\right)}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{d}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error7.5
Cost20996
\[\begin{array}{l} t_0 := c \cdot b - d \cdot a\\ \mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 2 \cdot 10^{+247}:\\ \;\;\;\;\frac{\frac{t_0}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{d}\right)\\ \end{array} \]
Alternative 2
Error13.0
Cost14492
\[\begin{array}{l} t_0 := b - d \cdot \frac{a}{c}\\ t_1 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;\frac{t_0}{c}\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -2.2761489133332196 \cdot 10^{-8}:\\ \;\;\;\;\frac{c}{d \cdot \frac{d}{b}} - \frac{a}{d}\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.0415742887118027 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.148732733672411 \cdot 10^{+97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(d, -a, c \cdot b\right)}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 3
Error9.9
Cost14160
\[\begin{array}{l} t_0 := \frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ t_1 := b - d \cdot \frac{a}{c}\\ \mathbf{if}\;c \leq -4.490116382232771 \cdot 10^{+114}:\\ \;\;\;\;\frac{t_1}{c}\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2.0415742887118027 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.148732733672411 \cdot 10^{+97}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 4
Error13.0
Cost7964
\[\begin{array}{l} t_0 := b - d \cdot \frac{a}{c}\\ t_1 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;\frac{t_0}{c}\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -2.2761489133332196 \cdot 10^{-8}:\\ \;\;\;\;\frac{c}{d \cdot \frac{d}{b}} - \frac{a}{d}\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.0415742887118027 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.148732733672411 \cdot 10^{+97}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]
Alternative 5
Error13.1
Cost1884
\[\begin{array}{l} t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -2.2761489133332196 \cdot 10^{-8}:\\ \;\;\;\;\frac{c}{d \cdot \frac{d}{b}} - \frac{a}{d}\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2.0415742887118027 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.148732733672411 \cdot 10^{+97}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 6
Error16.4
Cost1632
\[\begin{array}{l} t_0 := \frac{c \cdot \frac{b}{d} - a}{d}\\ t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.5659726218618048 \cdot 10^{-81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 317500939.7906411:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.1675900956826687 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.2168147847791367 \cdot 10^{+65}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error16.4
Cost1632
\[\begin{array}{l} t_0 := \frac{c \cdot \frac{b}{d} - a}{d}\\ t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\ t_2 := \frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -1.5659726218618048 \cdot 10^{-81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 317500939.7906411:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.1675900956826687 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.2168147847791367 \cdot 10^{+65}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error16.5
Cost1632
\[\begin{array}{l} t_0 := \frac{c \cdot \frac{b}{d} - a}{d}\\ t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\ \mathbf{elif}\;c \leq -1.5659726218618048 \cdot 10^{-81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq 317500939.7906411:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.1675900956826687 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.2168147847791367 \cdot 10^{+65}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error16.5
Cost1632
\[\begin{array}{l} t_0 := \frac{c \cdot \frac{b}{d} - a}{d}\\ t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\ \mathbf{elif}\;c \leq -1.5659726218618048 \cdot 10^{-81}:\\ \;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\ \mathbf{elif}\;c \leq -1 \cdot 10^{-120}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq 317500939.7906411:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.1675900956826687 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.2168147847791367 \cdot 10^{+65}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error19.6
Cost1104
\[\begin{array}{l} t_0 := \frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{if}\;c \leq -1.9673740714989925 \cdot 10^{+109}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -1.544508827741849 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 2.0142518985666746 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
Alternative 11
Error24.1
Cost784
\[\begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;c \leq -4.567322487019083 \cdot 10^{+29}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -1.0450242346714168 \cdot 10^{-79}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -9 \cdot 10^{-120}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 2.0142518985666746 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
Alternative 12
Error58.1
Cost324
\[\begin{array}{l} \mathbf{if}\;c \leq 317500939.7906411:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \]
Alternative 13
Error58.9
Cost192
\[\frac{b}{d} \]
Alternative 14
Error37.1
Cost192
\[\frac{b}{c} \]

Error

Reproduce

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