Complex division, imag part

Percentage Accurate: 62.0% → 92.7%
Time: 9.9s
Alternatives: 12
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d):
	return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d)
	return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function tmp = code(a, b, c, d)
	tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
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]
\begin{array}{l}

\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}

Sampling outcomes in binary64 precision:

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.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 62.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d):
	return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d)
	return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function tmp = code(a, b, c, d)
	tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
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]
\begin{array}{l}

\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}

Alternative 1: 92.7% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \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}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)\\ t_3 := \mathsf{fma}\left(t_0, t_1, -\frac{a}{d}\right)\\ \mathbf{if}\;d \leq -2 \cdot 10^{+137}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;d \leq -7.6 \cdot 10^{-131}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq 1.85 \cdot 10^{-154}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq 2.85 \cdot 10^{+167}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(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) (/ (pow (hypot c d) 2.0) d))))
        (t_3 (fma t_0 t_1 (- (/ a d)))))
   (if (<= d -2e+137)
     t_3
     (if (<= d -7.6e-131)
       t_2
       (if (<= d 1.85e-154)
         (/ (- b (/ (* d a) c)) c)
         (if (<= d 2.85e+167) t_2 t_3))))))
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 / (pow(hypot(c, d), 2.0) / d)));
	double t_3 = fma(t_0, t_1, -(a / d));
	double tmp;
	if (d <= -2e+137) {
		tmp = t_3;
	} else if (d <= -7.6e-131) {
		tmp = t_2;
	} else if (d <= 1.85e-154) {
		tmp = (b - ((d * a) / c)) / c;
	} else if (d <= 2.85e+167) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
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) / Float64((hypot(c, d) ^ 2.0) / d)))
	t_3 = fma(t_0, t_1, Float64(-Float64(a / d)))
	tmp = 0.0
	if (d <= -2e+137)
		tmp = t_3;
	elseif (d <= -7.6e-131)
		tmp = t_2;
	elseif (d <= 1.85e-154)
		tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c);
	elseif (d <= 2.85e+167)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
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) / N[(N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$1 + (-N[(a / d), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -2e+137], t$95$3, If[LessEqual[d, -7.6e-131], t$95$2, If[LessEqual[d, 1.85e-154], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.85e+167], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}

\\
\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}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)\\
t_3 := \mathsf{fma}\left(t_0, t_1, -\frac{a}{d}\right)\\
\mathbf{if}\;d \leq -2 \cdot 10^{+137}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;d \leq -7.6 \cdot 10^{-131}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;d \leq 2.85 \cdot 10^{+167}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -2.0000000000000001e137 or 2.85000000000000008e167 < d

    1. Initial program 34.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub34.7%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d}} \]
      2. *-commutative34.7%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      3. add-sqr-sqrt34.7%

        \[\leadsto \frac{c \cdot b}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      4. times-frac37.9%

        \[\leadsto \color{blue}{\frac{c}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b}{\sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      5. fma-neg37.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\sqrt{c \cdot c + d \cdot d}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      6. hypot-def37.9%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      7. hypot-def53.2%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      8. associate-/l*56.1%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\color{blue}{\frac{a}{\frac{c \cdot c + d \cdot d}{d}}}\right) \]
      9. add-sqr-sqrt56.1%

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

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{{\left(\sqrt{c \cdot c + d \cdot d}\right)}^{2}}}{d}}\right) \]
      11. hypot-def56.1%

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

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

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

    if -2.0000000000000001e137 < d < -7.59999999999999989e-131 or 1.84999999999999993e-154 < d < 2.85000000000000008e167

    1. Initial program 67.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub67.7%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d}} \]
      2. *-commutative67.7%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      3. add-sqr-sqrt67.7%

        \[\leadsto \frac{c \cdot b}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      4. times-frac72.5%

        \[\leadsto \color{blue}{\frac{c}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b}{\sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      5. fma-neg72.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\sqrt{c \cdot c + d \cdot d}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      6. hypot-def72.5%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      7. hypot-def88.3%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      8. associate-/l*96.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}{\frac{c \cdot c + d \cdot d}{d}}}\right) \]
      9. add-sqr-sqrt96.3%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}}{d}}\right) \]
      10. pow296.3%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{{\left(\sqrt{c \cdot c + d \cdot d}\right)}^{2}}}{d}}\right) \]
      11. hypot-def96.3%

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

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

    if -7.59999999999999989e-131 < d < 1.84999999999999993e-154

    1. Initial program 66.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative76.6%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg76.6%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac84.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified84.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*l/84.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot \frac{d}{c}}{c}} \]
      2. sub-div88.0%

        \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
    6. Applied egg-rr88.0%

      \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
    7. Step-by-step derivation
      1. *-commutative88.0%

        \[\leadsto \frac{b - \color{blue}{\frac{d}{c} \cdot a}}{c} \]
      2. associate-*l/90.6%

        \[\leadsto \frac{b - \color{blue}{\frac{d \cdot a}{c}}}{c} \]
    8. Applied egg-rr90.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2 \cdot 10^{+137}:\\ \;\;\;\;\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 -7.6 \cdot 10^{-131}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)\\ \mathbf{elif}\;d \leq 1.85 \cdot 10^{-154}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq 2.85 \cdot 10^{+167}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{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: 89.2% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot b - d \cdot a\\ \mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 10^{+302}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\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} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (- (* c b) (* d a))))
   (if (<= (/ t_0 (+ (* c c) (* d d))) 1e+302)
     (* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
     (fma (/ c (hypot c d)) (/ b (hypot c d)) (- (/ a d))))))
double code(double a, double b, double c, double d) {
	double t_0 = (c * b) - (d * a);
	double tmp;
	if ((t_0 / ((c * c) + (d * d))) <= 1e+302) {
		tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
	} else {
		tmp = fma((c / hypot(c, d)), (b / hypot(c, d)), -(a / d));
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(c * b) - Float64(d * a))
	tmp = 0.0
	if (Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) <= 1e+302)
		tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d)));
	else
		tmp = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(-Float64(a / d)));
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+302], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + (-N[(a / d), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot b - d \cdot a\\
\mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 10^{+302}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 1.0000000000000001e302

    1. Initial program 79.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. *-un-lft-identity79.3%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt79.3%

        \[\leadsto \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}}} \]
      3. times-frac79.3%

        \[\leadsto \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}}} \]
      4. hypot-def79.3%

        \[\leadsto \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}} \]
      5. hypot-def95.2%

        \[\leadsto \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. Applied egg-rr95.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)}} \]

    if 1.0000000000000001e302 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d)))

    1. Initial program 6.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub5.2%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d}} \]
      2. *-commutative5.2%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      3. add-sqr-sqrt5.2%

        \[\leadsto \frac{c \cdot b}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      4. times-frac14.4%

        \[\leadsto \color{blue}{\frac{c}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b}{\sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      5. fma-neg14.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\sqrt{c \cdot c + d \cdot d}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      6. hypot-def14.4%

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

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      8. associate-/l*60.5%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\color{blue}{\frac{a}{\frac{c \cdot c + d \cdot d}{d}}}\right) \]
      9. add-sqr-sqrt60.5%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}}{d}}\right) \]
      10. pow260.5%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{{\left(\sqrt{c \cdot c + d \cdot d}\right)}^{2}}}{d}}\right) \]
      11. hypot-def60.5%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(c, d\right)\right)}}^{2}}{d}}\right) \]
    3. Applied egg-rr60.5%

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

      \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\color{blue}{d}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d} \leq 10^{+302}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\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 3: 85.2% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := c \cdot b - d \cdot a\\
t_1 := \frac{t_0}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t_1 \leq 10^{+302}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 1.0000000000000001e302

    1. Initial program 79.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. *-un-lft-identity79.3%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt79.3%

        \[\leadsto \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}}} \]
      3. times-frac79.3%

        \[\leadsto \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}}} \]
      4. hypot-def79.3%

        \[\leadsto \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}} \]
      5. hypot-def95.2%

        \[\leadsto \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. Applied egg-rr95.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)}} \]

    if 1.0000000000000001e302 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < +inf.0

    1. Initial program 22.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
    3. Step-by-step derivation
      1. +-commutative60.8%

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(-\frac{a}{d}\right)} \]
      3. unsub-neg60.8%

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. *-commutative60.8%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} - \frac{a}{d} \]
      5. unpow260.8%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} - \frac{a}{d} \]
      6. times-frac70.2%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} - \frac{a}{d} \]
    4. Simplified70.2%

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

    if +inf.0 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d)))

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative45.0%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg45.0%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac59.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified59.4%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*l/59.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot \frac{d}{c}}{c}} \]
      2. sub-div59.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d} \leq 10^{+302}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d} \leq \infty:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]

Alternative 4: 79.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -4.4 \cdot 10^{+52}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 5.8 \cdot 10^{-92}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{+100}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- b (* d (/ a c))) c)))
   (if (<= c -4.4e+52)
     t_0
     (if (<= c 5.8e-92)
       (- (* (/ c d) (/ b d)) (/ a d))
       (if (<= c 3.3e+100) (/ (- (* c b) (* d a)) (fma c c (* d d))) t_0)))))
double code(double a, double b, double c, double d) {
	double t_0 = (b - (d * (a / c))) / c;
	double tmp;
	if (c <= -4.4e+52) {
		tmp = t_0;
	} else if (c <= 5.8e-92) {
		tmp = ((c / d) * (b / d)) - (a / d);
	} else if (c <= 3.3e+100) {
		tmp = ((c * b) - (d * a)) / fma(c, c, (d * d));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(b - Float64(d * Float64(a / c))) / c)
	tmp = 0.0
	if (c <= -4.4e+52)
		tmp = t_0;
	elseif (c <= 5.8e-92)
		tmp = Float64(Float64(Float64(c / d) * Float64(b / d)) - Float64(a / d));
	elseif (c <= 3.3e+100)
		tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / fma(c, c, Float64(d * d)));
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -4.4e+52], t$95$0, If[LessEqual[c, 5.8e-92], N[(N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 3.3e+100], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -4.4 \cdot 10^{+52}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 3.3 \cdot 10^{+100}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -4.4e52 or 3.3000000000000001e100 < c

    1. Initial program 39.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative76.0%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg76.0%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac85.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified85.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*r/86.7%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. sub-div86.7%

        \[\leadsto \color{blue}{\frac{b - \frac{a}{c} \cdot d}{c}} \]
    6. Applied egg-rr86.7%

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

    if -4.4e52 < c < 5.79999999999999969e-92

    1. Initial program 69.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
    3. Step-by-step derivation
      1. +-commutative77.3%

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(-\frac{a}{d}\right)} \]
      3. unsub-neg77.3%

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. *-commutative77.3%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} - \frac{a}{d} \]
      5. unpow277.3%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} - \frac{a}{d} \]
      6. times-frac82.0%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} - \frac{a}{d} \]
    4. Simplified82.0%

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

    if 5.79999999999999969e-92 < c < 3.3000000000000001e100

    1. Initial program 80.1%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. fma-def80.2%

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{\mathsf{fma}\left(c, c, d \cdot d\right)}} \]
    3. Simplified80.2%

      \[\leadsto \color{blue}{\frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c, c, d \cdot d\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -4.4 \cdot 10^{+52}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 5.8 \cdot 10^{-92}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{+100}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \end{array} \]

Alternative 5: 66.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\frac{a}{d}\\ t_1 := \frac{b - a \cdot \frac{d}{c}}{c}\\ t_2 := \frac{c}{d} \cdot \frac{b}{d}\\ \mathbf{if}\;c \leq -2.05 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.04 \cdot 10^{-54}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -2.2 \cdot 10^{-105}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.1 \cdot 10^{-113}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 2400:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 5.2 \cdot 10^{+26} \lor \neg \left(c \leq 9.5 \cdot 10^{+99}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (- (/ a d)))
        (t_1 (/ (- b (* a (/ d c))) c))
        (t_2 (* (/ c d) (/ b d))))
   (if (<= c -2.05e+19)
     t_1
     (if (<= c -1.04e-54)
       t_0
       (if (<= c -2.2e-105)
         t_1
         (if (<= c -1.1e-113)
           t_2
           (if (<= c 2400.0)
             t_0
             (if (or (<= c 5.2e+26) (not (<= c 9.5e+99))) t_1 t_2))))))))
double code(double a, double b, double c, double d) {
	double t_0 = -(a / d);
	double t_1 = (b - (a * (d / c))) / c;
	double t_2 = (c / d) * (b / d);
	double tmp;
	if (c <= -2.05e+19) {
		tmp = t_1;
	} else if (c <= -1.04e-54) {
		tmp = t_0;
	} else if (c <= -2.2e-105) {
		tmp = t_1;
	} else if (c <= -1.1e-113) {
		tmp = t_2;
	} else if (c <= 2400.0) {
		tmp = t_0;
	} else if ((c <= 5.2e+26) || !(c <= 9.5e+99)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = -(a / d)
    t_1 = (b - (a * (d / c))) / c
    t_2 = (c / d) * (b / d)
    if (c <= (-2.05d+19)) then
        tmp = t_1
    else if (c <= (-1.04d-54)) then
        tmp = t_0
    else if (c <= (-2.2d-105)) then
        tmp = t_1
    else if (c <= (-1.1d-113)) then
        tmp = t_2
    else if (c <= 2400.0d0) then
        tmp = t_0
    else if ((c <= 5.2d+26) .or. (.not. (c <= 9.5d+99))) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = -(a / d);
	double t_1 = (b - (a * (d / c))) / c;
	double t_2 = (c / d) * (b / d);
	double tmp;
	if (c <= -2.05e+19) {
		tmp = t_1;
	} else if (c <= -1.04e-54) {
		tmp = t_0;
	} else if (c <= -2.2e-105) {
		tmp = t_1;
	} else if (c <= -1.1e-113) {
		tmp = t_2;
	} else if (c <= 2400.0) {
		tmp = t_0;
	} else if ((c <= 5.2e+26) || !(c <= 9.5e+99)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = -(a / d)
	t_1 = (b - (a * (d / c))) / c
	t_2 = (c / d) * (b / d)
	tmp = 0
	if c <= -2.05e+19:
		tmp = t_1
	elif c <= -1.04e-54:
		tmp = t_0
	elif c <= -2.2e-105:
		tmp = t_1
	elif c <= -1.1e-113:
		tmp = t_2
	elif c <= 2400.0:
		tmp = t_0
	elif (c <= 5.2e+26) or not (c <= 9.5e+99):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(a, b, c, d)
	t_0 = Float64(-Float64(a / d))
	t_1 = Float64(Float64(b - Float64(a * Float64(d / c))) / c)
	t_2 = Float64(Float64(c / d) * Float64(b / d))
	tmp = 0.0
	if (c <= -2.05e+19)
		tmp = t_1;
	elseif (c <= -1.04e-54)
		tmp = t_0;
	elseif (c <= -2.2e-105)
		tmp = t_1;
	elseif (c <= -1.1e-113)
		tmp = t_2;
	elseif (c <= 2400.0)
		tmp = t_0;
	elseif ((c <= 5.2e+26) || !(c <= 9.5e+99))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = -(a / d);
	t_1 = (b - (a * (d / c))) / c;
	t_2 = (c / d) * (b / d);
	tmp = 0.0;
	if (c <= -2.05e+19)
		tmp = t_1;
	elseif (c <= -1.04e-54)
		tmp = t_0;
	elseif (c <= -2.2e-105)
		tmp = t_1;
	elseif (c <= -1.1e-113)
		tmp = t_2;
	elseif (c <= 2400.0)
		tmp = t_0;
	elseif ((c <= 5.2e+26) || ~((c <= 9.5e+99)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = (-N[(a / d), $MachinePrecision])}, Block[{t$95$1 = N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.05e+19], t$95$1, If[LessEqual[c, -1.04e-54], t$95$0, If[LessEqual[c, -2.2e-105], t$95$1, If[LessEqual[c, -1.1e-113], t$95$2, If[LessEqual[c, 2400.0], t$95$0, If[Or[LessEqual[c, 5.2e+26], N[Not[LessEqual[c, 9.5e+99]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\frac{a}{d}\\
t_1 := \frac{b - a \cdot \frac{d}{c}}{c}\\
t_2 := \frac{c}{d} \cdot \frac{b}{d}\\
\mathbf{if}\;c \leq -2.05 \cdot 10^{+19}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -1.04 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq -2.2 \cdot 10^{-105}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -1.1 \cdot 10^{-113}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \leq 2400:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq 5.2 \cdot 10^{+26} \lor \neg \left(c \leq 9.5 \cdot 10^{+99}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -2.05e19 or -1.04e-54 < c < -2.20000000000000004e-105 or 2400 < c < 5.20000000000000004e26 or 9.49999999999999908e99 < c

    1. Initial program 46.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative74.4%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg74.4%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac82.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified82.4%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*l/81.6%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot \frac{d}{c}}{c}} \]
      2. sub-div81.6%

        \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
    6. Applied egg-rr81.6%

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

    if -2.05e19 < c < -1.04e-54 or -1.10000000000000002e-113 < c < 2400

    1. Initial program 70.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/75.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-175.9%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified75.9%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if -2.20000000000000004e-105 < c < -1.10000000000000002e-113 or 5.20000000000000004e26 < c < 9.49999999999999908e99

    1. Initial program 72.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub72.6%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d}} \]
      2. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      3. add-sqr-sqrt72.6%

        \[\leadsto \frac{c \cdot b}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      4. times-frac86.4%

        \[\leadsto \color{blue}{\frac{c}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b}{\sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      5. fma-neg86.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\sqrt{c \cdot c + d \cdot d}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      6. hypot-def86.4%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      7. hypot-def94.9%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      8. associate-/l*90.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\color{blue}{\frac{a}{\frac{c \cdot c + d \cdot d}{d}}}\right) \]
      9. add-sqr-sqrt90.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}}{d}}\right) \]
      10. pow290.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{{\left(\sqrt{c \cdot c + d \cdot d}\right)}^{2}}}{d}}\right) \]
      11. hypot-def90.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(c, d\right)\right)}}^{2}}{d}}\right) \]
    3. Applied egg-rr90.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}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)} \]
    4. Taylor expanded in b around inf 57.3%

      \[\leadsto \color{blue}{\frac{b \cdot c}{{c}^{2} + {d}^{2}}} \]
    5. Step-by-step derivation
      1. *-commutative57.3%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{c}^{2} + {d}^{2}} \]
      2. unpow257.3%

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

        \[\leadsto \frac{c \cdot b}{\color{blue}{{d}^{2} + c \cdot c}} \]
      4. unpow257.3%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d} + c \cdot c} \]
    6. Simplified57.3%

      \[\leadsto \color{blue}{\frac{c \cdot b}{d \cdot d + c \cdot c}} \]
    7. Taylor expanded in c around 0 52.9%

      \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
    8. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} \]
      2. unpow252.9%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} \]
      3. times-frac70.7%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} \]
    9. Simplified70.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.05 \cdot 10^{+19}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq -1.04 \cdot 10^{-54}:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{elif}\;c \leq -2.2 \cdot 10^{-105}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq -1.1 \cdot 10^{-113}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d}\\ \mathbf{elif}\;c \leq 2400:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{elif}\;c \leq 5.2 \cdot 10^{+26} \lor \neg \left(c \leq 9.5 \cdot 10^{+99}\right):\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d}\\ \end{array} \]

Alternative 6: 66.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\frac{a}{d}\\ t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\ t_2 := \frac{c}{d} \cdot \frac{b}{d}\\ \mathbf{if}\;c \leq -5.6 \cdot 10^{+18}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -8.7 \cdot 10^{-57}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -1.25 \cdot 10^{-105}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.1 \cdot 10^{-113}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 3100:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 3.2 \cdot 10^{+26}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{+99}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (- (/ a d)))
        (t_1 (/ (- b (* d (/ a c))) c))
        (t_2 (* (/ c d) (/ b d))))
   (if (<= c -5.6e+18)
     t_1
     (if (<= c -8.7e-57)
       t_0
       (if (<= c -1.25e-105)
         t_1
         (if (<= c -1.1e-113)
           t_2
           (if (<= c 3100.0)
             t_0
             (if (<= c 3.2e+26)
               (/ (- b (* a (/ d c))) c)
               (if (<= c 9.5e+99) t_2 t_1)))))))))
double code(double a, double b, double c, double d) {
	double t_0 = -(a / d);
	double t_1 = (b - (d * (a / c))) / c;
	double t_2 = (c / d) * (b / d);
	double tmp;
	if (c <= -5.6e+18) {
		tmp = t_1;
	} else if (c <= -8.7e-57) {
		tmp = t_0;
	} else if (c <= -1.25e-105) {
		tmp = t_1;
	} else if (c <= -1.1e-113) {
		tmp = t_2;
	} else if (c <= 3100.0) {
		tmp = t_0;
	} else if (c <= 3.2e+26) {
		tmp = (b - (a * (d / c))) / c;
	} else if (c <= 9.5e+99) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = -(a / d)
    t_1 = (b - (d * (a / c))) / c
    t_2 = (c / d) * (b / d)
    if (c <= (-5.6d+18)) then
        tmp = t_1
    else if (c <= (-8.7d-57)) then
        tmp = t_0
    else if (c <= (-1.25d-105)) then
        tmp = t_1
    else if (c <= (-1.1d-113)) then
        tmp = t_2
    else if (c <= 3100.0d0) then
        tmp = t_0
    else if (c <= 3.2d+26) then
        tmp = (b - (a * (d / c))) / c
    else if (c <= 9.5d+99) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = -(a / d);
	double t_1 = (b - (d * (a / c))) / c;
	double t_2 = (c / d) * (b / d);
	double tmp;
	if (c <= -5.6e+18) {
		tmp = t_1;
	} else if (c <= -8.7e-57) {
		tmp = t_0;
	} else if (c <= -1.25e-105) {
		tmp = t_1;
	} else if (c <= -1.1e-113) {
		tmp = t_2;
	} else if (c <= 3100.0) {
		tmp = t_0;
	} else if (c <= 3.2e+26) {
		tmp = (b - (a * (d / c))) / c;
	} else if (c <= 9.5e+99) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = -(a / d)
	t_1 = (b - (d * (a / c))) / c
	t_2 = (c / d) * (b / d)
	tmp = 0
	if c <= -5.6e+18:
		tmp = t_1
	elif c <= -8.7e-57:
		tmp = t_0
	elif c <= -1.25e-105:
		tmp = t_1
	elif c <= -1.1e-113:
		tmp = t_2
	elif c <= 3100.0:
		tmp = t_0
	elif c <= 3.2e+26:
		tmp = (b - (a * (d / c))) / c
	elif c <= 9.5e+99:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(a, b, c, d)
	t_0 = Float64(-Float64(a / d))
	t_1 = Float64(Float64(b - Float64(d * Float64(a / c))) / c)
	t_2 = Float64(Float64(c / d) * Float64(b / d))
	tmp = 0.0
	if (c <= -5.6e+18)
		tmp = t_1;
	elseif (c <= -8.7e-57)
		tmp = t_0;
	elseif (c <= -1.25e-105)
		tmp = t_1;
	elseif (c <= -1.1e-113)
		tmp = t_2;
	elseif (c <= 3100.0)
		tmp = t_0;
	elseif (c <= 3.2e+26)
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c);
	elseif (c <= 9.5e+99)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = -(a / d);
	t_1 = (b - (d * (a / c))) / c;
	t_2 = (c / d) * (b / d);
	tmp = 0.0;
	if (c <= -5.6e+18)
		tmp = t_1;
	elseif (c <= -8.7e-57)
		tmp = t_0;
	elseif (c <= -1.25e-105)
		tmp = t_1;
	elseif (c <= -1.1e-113)
		tmp = t_2;
	elseif (c <= 3100.0)
		tmp = t_0;
	elseif (c <= 3.2e+26)
		tmp = (b - (a * (d / c))) / c;
	elseif (c <= 9.5e+99)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = (-N[(a / d), $MachinePrecision])}, Block[{t$95$1 = N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -5.6e+18], t$95$1, If[LessEqual[c, -8.7e-57], t$95$0, If[LessEqual[c, -1.25e-105], t$95$1, If[LessEqual[c, -1.1e-113], t$95$2, If[LessEqual[c, 3100.0], t$95$0, If[LessEqual[c, 3.2e+26], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 9.5e+99], t$95$2, t$95$1]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\frac{a}{d}\\
t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\
t_2 := \frac{c}{d} \cdot \frac{b}{d}\\
\mathbf{if}\;c \leq -5.6 \cdot 10^{+18}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -8.7 \cdot 10^{-57}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq -1.25 \cdot 10^{-105}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -1.1 \cdot 10^{-113}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c \leq 3100:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq 3.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\

\mathbf{elif}\;c \leq 9.5 \cdot 10^{+99}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -5.6e18 or -8.7000000000000002e-57 < c < -1.24999999999999991e-105 or 9.49999999999999908e99 < c

    1. Initial program 44.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative73.5%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg73.5%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac81.8%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified81.8%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*r/82.9%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. sub-div82.9%

        \[\leadsto \color{blue}{\frac{b - \frac{a}{c} \cdot d}{c}} \]
    6. Applied egg-rr82.9%

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

    if -5.6e18 < c < -8.7000000000000002e-57 or -1.10000000000000002e-113 < c < 3100

    1. Initial program 70.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/75.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-175.9%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified75.9%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if -1.24999999999999991e-105 < c < -1.10000000000000002e-113 or 3.20000000000000029e26 < c < 9.49999999999999908e99

    1. Initial program 72.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub72.6%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d}} \]
      2. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      3. add-sqr-sqrt72.6%

        \[\leadsto \frac{c \cdot b}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      4. times-frac86.4%

        \[\leadsto \color{blue}{\frac{c}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b}{\sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      5. fma-neg86.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\sqrt{c \cdot c + d \cdot d}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      6. hypot-def86.4%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      7. hypot-def94.9%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      8. associate-/l*90.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\color{blue}{\frac{a}{\frac{c \cdot c + d \cdot d}{d}}}\right) \]
      9. add-sqr-sqrt90.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}}{d}}\right) \]
      10. pow290.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{{\left(\sqrt{c \cdot c + d \cdot d}\right)}^{2}}}{d}}\right) \]
      11. hypot-def90.6%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(c, d\right)\right)}}^{2}}{d}}\right) \]
    3. Applied egg-rr90.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}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)} \]
    4. Taylor expanded in b around inf 57.3%

      \[\leadsto \color{blue}{\frac{b \cdot c}{{c}^{2} + {d}^{2}}} \]
    5. Step-by-step derivation
      1. *-commutative57.3%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{c}^{2} + {d}^{2}} \]
      2. unpow257.3%

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

        \[\leadsto \frac{c \cdot b}{\color{blue}{{d}^{2} + c \cdot c}} \]
      4. unpow257.3%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d} + c \cdot c} \]
    6. Simplified57.3%

      \[\leadsto \color{blue}{\frac{c \cdot b}{d \cdot d + c \cdot c}} \]
    7. Taylor expanded in c around 0 52.9%

      \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
    8. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} \]
      2. unpow252.9%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} \]
      3. times-frac70.7%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} \]
    9. Simplified70.7%

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

    if 3100 < c < 3.20000000000000029e26

    1. Initial program 99.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative95.2%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg95.2%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac95.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified95.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*l/95.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot \frac{d}{c}}{c}} \]
      2. sub-div95.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -5.6 \cdot 10^{+18}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -8.7 \cdot 10^{-57}:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{elif}\;c \leq -1.25 \cdot 10^{-105}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -1.1 \cdot 10^{-113}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d}\\ \mathbf{elif}\;c \leq 3100:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{elif}\;c \leq 3.2 \cdot 10^{+26}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{+99}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \end{array} \]

Alternative 7: 79.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -8.6 \cdot 10^{+52}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2.5 \cdot 10^{-89}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{+102}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- b (* d (/ a c))) c)))
   (if (<= c -8.6e+52)
     t_0
     (if (<= c 2.5e-89)
       (- (* (/ c d) (/ b d)) (/ a d))
       (if (<= c 1.1e+102) (/ (- (* c b) (* d a)) (+ (* c c) (* d d))) t_0)))))
double code(double a, double b, double c, double d) {
	double t_0 = (b - (d * (a / c))) / c;
	double tmp;
	if (c <= -8.6e+52) {
		tmp = t_0;
	} else if (c <= 2.5e-89) {
		tmp = ((c / d) * (b / d)) - (a / d);
	} else if (c <= 1.1e+102) {
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (b - (d * (a / c))) / c
    if (c <= (-8.6d+52)) then
        tmp = t_0
    else if (c <= 2.5d-89) then
        tmp = ((c / d) * (b / d)) - (a / d)
    else if (c <= 1.1d+102) then
        tmp = ((c * b) - (d * a)) / ((c * c) + (d * d))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = (b - (d * (a / c))) / c;
	double tmp;
	if (c <= -8.6e+52) {
		tmp = t_0;
	} else if (c <= 2.5e-89) {
		tmp = ((c / d) * (b / d)) - (a / d);
	} else if (c <= 1.1e+102) {
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (b - (d * (a / c))) / c
	tmp = 0
	if c <= -8.6e+52:
		tmp = t_0
	elif c <= 2.5e-89:
		tmp = ((c / d) * (b / d)) - (a / d)
	elif c <= 1.1e+102:
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d))
	else:
		tmp = t_0
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(b - Float64(d * Float64(a / c))) / c)
	tmp = 0.0
	if (c <= -8.6e+52)
		tmp = t_0;
	elseif (c <= 2.5e-89)
		tmp = Float64(Float64(Float64(c / d) * Float64(b / d)) - Float64(a / d));
	elseif (c <= 1.1e+102)
		tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (b - (d * (a / c))) / c;
	tmp = 0.0;
	if (c <= -8.6e+52)
		tmp = t_0;
	elseif (c <= 2.5e-89)
		tmp = ((c / d) * (b / d)) - (a / d);
	elseif (c <= 1.1e+102)
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -8.6e+52], t$95$0, If[LessEqual[c, 2.5e-89], N[(N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.1e+102], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -8.6 \cdot 10^{+52}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 1.1 \cdot 10^{+102}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -8.5999999999999999e52 or 1.10000000000000004e102 < c

    1. Initial program 39.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative76.0%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg76.0%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac85.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified85.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*r/86.7%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. sub-div86.7%

        \[\leadsto \color{blue}{\frac{b - \frac{a}{c} \cdot d}{c}} \]
    6. Applied egg-rr86.7%

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

    if -8.5999999999999999e52 < c < 2.49999999999999983e-89

    1. Initial program 69.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
    3. Step-by-step derivation
      1. +-commutative77.3%

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(-\frac{a}{d}\right)} \]
      3. unsub-neg77.3%

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. *-commutative77.3%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} - \frac{a}{d} \]
      5. unpow277.3%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} - \frac{a}{d} \]
      6. times-frac82.0%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} - \frac{a}{d} \]
    4. Simplified82.0%

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

    if 2.49999999999999983e-89 < c < 1.10000000000000004e102

    1. Initial program 80.1%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -8.6 \cdot 10^{+52}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 2.5 \cdot 10^{-89}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{+102}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \end{array} \]

Alternative 8: 76.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -5.2 \cdot 10^{+53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 19000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2.3 \cdot 10^{+23}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 1.35 \cdot 10^{+90}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (- (* (/ c d) (/ b d)) (/ a d))) (t_1 (/ (- b (* d (/ a c))) c)))
   (if (<= c -5.2e+53)
     t_1
     (if (<= c 19000000000.0)
       t_0
       (if (<= c 2.3e+23)
         (/ (- b (* a (/ d c))) c)
         (if (<= c 1.35e+90) t_0 t_1))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((c / d) * (b / d)) - (a / d);
	double t_1 = (b - (d * (a / c))) / c;
	double tmp;
	if (c <= -5.2e+53) {
		tmp = t_1;
	} else if (c <= 19000000000.0) {
		tmp = t_0;
	} else if (c <= 2.3e+23) {
		tmp = (b - (a * (d / c))) / c;
	} else if (c <= 1.35e+90) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ((c / d) * (b / d)) - (a / d)
    t_1 = (b - (d * (a / c))) / c
    if (c <= (-5.2d+53)) then
        tmp = t_1
    else if (c <= 19000000000.0d0) then
        tmp = t_0
    else if (c <= 2.3d+23) then
        tmp = (b - (a * (d / c))) / c
    else if (c <= 1.35d+90) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = ((c / d) * (b / d)) - (a / d);
	double t_1 = (b - (d * (a / c))) / c;
	double tmp;
	if (c <= -5.2e+53) {
		tmp = t_1;
	} else if (c <= 19000000000.0) {
		tmp = t_0;
	} else if (c <= 2.3e+23) {
		tmp = (b - (a * (d / c))) / c;
	} else if (c <= 1.35e+90) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((c / d) * (b / d)) - (a / d)
	t_1 = (b - (d * (a / c))) / c
	tmp = 0
	if c <= -5.2e+53:
		tmp = t_1
	elif c <= 19000000000.0:
		tmp = t_0
	elif c <= 2.3e+23:
		tmp = (b - (a * (d / c))) / c
	elif c <= 1.35e+90:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(c / d) * Float64(b / d)) - Float64(a / d))
	t_1 = Float64(Float64(b - Float64(d * Float64(a / c))) / c)
	tmp = 0.0
	if (c <= -5.2e+53)
		tmp = t_1;
	elseif (c <= 19000000000.0)
		tmp = t_0;
	elseif (c <= 2.3e+23)
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c);
	elseif (c <= 1.35e+90)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((c / d) * (b / d)) - (a / d);
	t_1 = (b - (d * (a / c))) / c;
	tmp = 0.0;
	if (c <= -5.2e+53)
		tmp = t_1;
	elseif (c <= 19000000000.0)
		tmp = t_0;
	elseif (c <= 2.3e+23)
		tmp = (b - (a * (d / c))) / c;
	elseif (c <= 1.35e+90)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -5.2e+53], t$95$1, If[LessEqual[c, 19000000000.0], t$95$0, If[LessEqual[c, 2.3e+23], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 1.35e+90], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
t_1 := \frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -5.2 \cdot 10^{+53}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq 19000000000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq 2.3 \cdot 10^{+23}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\

\mathbf{elif}\;c \leq 1.35 \cdot 10^{+90}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -5.19999999999999996e53 or 1.35e90 < c

    1. Initial program 41.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative75.2%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg75.2%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac84.2%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified84.2%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*r/85.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. sub-div85.5%

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

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

    if -5.19999999999999996e53 < c < 1.9e10 or 2.3e23 < c < 1.35e90

    1. Initial program 70.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
    3. Step-by-step derivation
      1. +-commutative73.9%

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(-\frac{a}{d}\right)} \]
      3. unsub-neg73.9%

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. *-commutative73.9%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} - \frac{a}{d} \]
      5. unpow273.9%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} - \frac{a}{d} \]
      6. times-frac81.2%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} - \frac{a}{d} \]
    4. Simplified81.2%

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

    if 1.9e10 < c < 2.3e23

    1. Initial program 99.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative95.2%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg95.2%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac95.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified95.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*l/95.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot \frac{d}{c}}{c}} \]
      2. sub-div95.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -5.2 \cdot 10^{+53}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 19000000000:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{elif}\;c \leq 2.3 \cdot 10^{+23}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 1.35 \cdot 10^{+90}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \end{array} \]

Alternative 9: 75.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{if}\;c \leq -7 \cdot 10^{+55}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 6500000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 8.5 \cdot 10^{+19}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 6.6 \cdot 10^{+92}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (- (* (/ c d) (/ b d)) (/ a d))))
   (if (<= c -7e+55)
     (/ (- b (* d (/ a c))) c)
     (if (<= c 6500000000.0)
       t_0
       (if (<= c 8.5e+19)
         (/ (- b (* a (/ d c))) c)
         (if (<= c 6.6e+92) t_0 (- (/ b c) (/ d (* c (/ c a))))))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((c / d) * (b / d)) - (a / d);
	double tmp;
	if (c <= -7e+55) {
		tmp = (b - (d * (a / c))) / c;
	} else if (c <= 6500000000.0) {
		tmp = t_0;
	} else if (c <= 8.5e+19) {
		tmp = (b - (a * (d / c))) / c;
	} else if (c <= 6.6e+92) {
		tmp = t_0;
	} else {
		tmp = (b / c) - (d / (c * (c / a)));
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((c / d) * (b / d)) - (a / d)
    if (c <= (-7d+55)) then
        tmp = (b - (d * (a / c))) / c
    else if (c <= 6500000000.0d0) then
        tmp = t_0
    else if (c <= 8.5d+19) then
        tmp = (b - (a * (d / c))) / c
    else if (c <= 6.6d+92) then
        tmp = t_0
    else
        tmp = (b / c) - (d / (c * (c / a)))
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = ((c / d) * (b / d)) - (a / d);
	double tmp;
	if (c <= -7e+55) {
		tmp = (b - (d * (a / c))) / c;
	} else if (c <= 6500000000.0) {
		tmp = t_0;
	} else if (c <= 8.5e+19) {
		tmp = (b - (a * (d / c))) / c;
	} else if (c <= 6.6e+92) {
		tmp = t_0;
	} else {
		tmp = (b / c) - (d / (c * (c / a)));
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((c / d) * (b / d)) - (a / d)
	tmp = 0
	if c <= -7e+55:
		tmp = (b - (d * (a / c))) / c
	elif c <= 6500000000.0:
		tmp = t_0
	elif c <= 8.5e+19:
		tmp = (b - (a * (d / c))) / c
	elif c <= 6.6e+92:
		tmp = t_0
	else:
		tmp = (b / c) - (d / (c * (c / a)))
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(c / d) * Float64(b / d)) - Float64(a / d))
	tmp = 0.0
	if (c <= -7e+55)
		tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c);
	elseif (c <= 6500000000.0)
		tmp = t_0;
	elseif (c <= 8.5e+19)
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c);
	elseif (c <= 6.6e+92)
		tmp = t_0;
	else
		tmp = Float64(Float64(b / c) - Float64(d / Float64(c * Float64(c / a))));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((c / d) * (b / d)) - (a / d);
	tmp = 0.0;
	if (c <= -7e+55)
		tmp = (b - (d * (a / c))) / c;
	elseif (c <= 6500000000.0)
		tmp = t_0;
	elseif (c <= 8.5e+19)
		tmp = (b - (a * (d / c))) / c;
	elseif (c <= 6.6e+92)
		tmp = t_0;
	else
		tmp = (b / c) - (d / (c * (c / a)));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -7e+55], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 6500000000.0], t$95$0, If[LessEqual[c, 8.5e+19], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 6.6e+92], t$95$0, N[(N[(b / c), $MachinePrecision] - N[(d / N[(c * N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{if}\;c \leq -7 \cdot 10^{+55}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\

\mathbf{elif}\;c \leq 6500000000:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 6.6 \cdot 10^{+92}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -7.00000000000000021e55

    1. Initial program 49.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative79.1%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg79.1%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac88.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified88.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*r/90.0%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. sub-div90.0%

        \[\leadsto \color{blue}{\frac{b - \frac{a}{c} \cdot d}{c}} \]
    6. Applied egg-rr90.0%

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

    if -7.00000000000000021e55 < c < 6.5e9 or 8.5e19 < c < 6.59999999999999948e92

    1. Initial program 70.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
    3. Step-by-step derivation
      1. +-commutative73.9%

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(-\frac{a}{d}\right)} \]
      3. unsub-neg73.9%

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. *-commutative73.9%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} - \frac{a}{d} \]
      5. unpow273.9%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} - \frac{a}{d} \]
      6. times-frac81.2%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} - \frac{a}{d} \]
    4. Simplified81.2%

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

    if 6.5e9 < c < 8.5e19

    1. Initial program 99.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative95.2%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg95.2%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac95.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified95.5%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. associate-*l/95.5%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot \frac{d}{c}}{c}} \]
      2. sub-div95.5%

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

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

    if 6.59999999999999948e92 < c

    1. Initial program 31.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. +-commutative70.2%

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

        \[\leadsto \frac{b}{c} + \color{blue}{\left(-\frac{a \cdot d}{{c}^{2}}\right)} \]
      3. unsub-neg70.2%

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

        \[\leadsto \frac{b}{c} - \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      5. times-frac78.8%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a}{c} \cdot \frac{d}{c}} \]
    4. Simplified78.8%

      \[\leadsto \color{blue}{\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}} \]
    5. Step-by-step derivation
      1. clear-num78.9%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{1}{\frac{c}{a}}} \cdot \frac{d}{c} \]
      2. frac-times79.8%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{1 \cdot d}{\frac{c}{a} \cdot c}} \]
      3. *-un-lft-identity79.8%

        \[\leadsto \frac{b}{c} - \frac{\color{blue}{d}}{\frac{c}{a} \cdot c} \]
    6. Applied egg-rr79.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -7 \cdot 10^{+55}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 6500000000:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{elif}\;c \leq 8.5 \cdot 10^{+19}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 6.6 \cdot 10^{+92}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\ \end{array} \]

Alternative 10: 61.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -7.8 \cdot 10^{+18}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{-30}:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{+99}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -7.8e+18)
   (/ b c)
   (if (<= c 6.5e-30)
     (- (/ a d))
     (if (<= c 9.5e+99) (* (/ c d) (/ b d)) (/ b c)))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -7.8e+18) {
		tmp = b / c;
	} else if (c <= 6.5e-30) {
		tmp = -(a / d);
	} else if (c <= 9.5e+99) {
		tmp = (c / d) * (b / d);
	} else {
		tmp = b / c;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: tmp
    if (c <= (-7.8d+18)) then
        tmp = b / c
    else if (c <= 6.5d-30) then
        tmp = -(a / d)
    else if (c <= 9.5d+99) then
        tmp = (c / d) * (b / d)
    else
        tmp = b / c
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -7.8e+18) {
		tmp = b / c;
	} else if (c <= 6.5e-30) {
		tmp = -(a / d);
	} else if (c <= 9.5e+99) {
		tmp = (c / d) * (b / d);
	} else {
		tmp = b / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if c <= -7.8e+18:
		tmp = b / c
	elif c <= 6.5e-30:
		tmp = -(a / d)
	elif c <= 9.5e+99:
		tmp = (c / d) * (b / d)
	else:
		tmp = b / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -7.8e+18)
		tmp = Float64(b / c);
	elseif (c <= 6.5e-30)
		tmp = Float64(-Float64(a / d));
	elseif (c <= 9.5e+99)
		tmp = Float64(Float64(c / d) * Float64(b / d));
	else
		tmp = Float64(b / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (c <= -7.8e+18)
		tmp = b / c;
	elseif (c <= 6.5e-30)
		tmp = -(a / d);
	elseif (c <= 9.5e+99)
		tmp = (c / d) * (b / d);
	else
		tmp = b / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[c, -7.8e+18], N[(b / c), $MachinePrecision], If[LessEqual[c, 6.5e-30], (-N[(a / d), $MachinePrecision]), If[LessEqual[c, 9.5e+99], N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -7.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq 6.5 \cdot 10^{-30}:\\
\;\;\;\;-\frac{a}{d}\\

\mathbf{elif}\;c \leq 9.5 \cdot 10^{+99}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -7.8e18 or 9.49999999999999908e99 < c

    1. Initial program 42.8%

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

      \[\leadsto \color{blue}{\frac{b}{c}} \]

    if -7.8e18 < c < 6.5000000000000005e-30

    1. Initial program 71.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/72.4%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-172.4%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if 6.5000000000000005e-30 < c < 9.49999999999999908e99

    1. Initial program 71.9%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub71.9%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d}} \]
      2. *-commutative71.9%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      3. add-sqr-sqrt71.8%

        \[\leadsto \frac{c \cdot b}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      4. times-frac83.9%

        \[\leadsto \color{blue}{\frac{c}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b}{\sqrt{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{c \cdot c + d \cdot d} \]
      5. fma-neg83.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\sqrt{c \cdot c + d \cdot d}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      6. hypot-def83.9%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, \frac{b}{\sqrt{c \cdot c + d \cdot d}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      7. hypot-def95.5%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\color{blue}{\mathsf{hypot}\left(c, d\right)}}, -\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      8. associate-/l*91.7%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\color{blue}{\frac{a}{\frac{c \cdot c + d \cdot d}{d}}}\right) \]
      9. add-sqr-sqrt91.7%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}}{d}}\right) \]
      10. pow291.7%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{\color{blue}{{\left(\sqrt{c \cdot c + d \cdot d}\right)}^{2}}}{d}}\right) \]
      11. hypot-def91.7%

        \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(c, d\right)\right)}}^{2}}{d}}\right) \]
    3. Applied egg-rr91.7%

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

      \[\leadsto \color{blue}{\frac{b \cdot c}{{c}^{2} + {d}^{2}}} \]
    5. Step-by-step derivation
      1. *-commutative48.1%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{c}^{2} + {d}^{2}} \]
      2. unpow248.1%

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

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

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d} + c \cdot c} \]
    6. Simplified48.1%

      \[\leadsto \color{blue}{\frac{c \cdot b}{d \cdot d + c \cdot c}} \]
    7. Taylor expanded in c around 0 32.5%

      \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
    8. Step-by-step derivation
      1. *-commutative32.5%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{{d}^{2}} \]
      2. unpow232.5%

        \[\leadsto \frac{c \cdot b}{\color{blue}{d \cdot d}} \]
      3. times-frac52.1%

        \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} \]
    9. Simplified52.1%

      \[\leadsto \color{blue}{\frac{c}{d} \cdot \frac{b}{d}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -7.8 \cdot 10^{+18}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{-30}:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{+99}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]

Alternative 11: 63.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1.35 \cdot 10^{+18}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.15 \cdot 10^{+99}:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -1.35e+18) (/ b c) (if (<= c 1.15e+99) (- (/ a d)) (/ b c))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -1.35e+18) {
		tmp = b / c;
	} else if (c <= 1.15e+99) {
		tmp = -(a / d);
	} else {
		tmp = b / c;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: tmp
    if (c <= (-1.35d+18)) then
        tmp = b / c
    else if (c <= 1.15d+99) then
        tmp = -(a / d)
    else
        tmp = b / c
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -1.35e+18) {
		tmp = b / c;
	} else if (c <= 1.15e+99) {
		tmp = -(a / d);
	} else {
		tmp = b / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if c <= -1.35e+18:
		tmp = b / c
	elif c <= 1.15e+99:
		tmp = -(a / d)
	else:
		tmp = b / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -1.35e+18)
		tmp = Float64(b / c);
	elseif (c <= 1.15e+99)
		tmp = Float64(-Float64(a / d));
	else
		tmp = Float64(b / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (c <= -1.35e+18)
		tmp = b / c;
	elseif (c <= 1.15e+99)
		tmp = -(a / d);
	else
		tmp = b / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.35e+18], N[(b / c), $MachinePrecision], If[LessEqual[c, 1.15e+99], (-N[(a / d), $MachinePrecision]), N[(b / c), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.35 \cdot 10^{+18}:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq 1.15 \cdot 10^{+99}:\\
\;\;\;\;-\frac{a}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.35e18 or 1.1500000000000001e99 < c

    1. Initial program 43.3%

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

      \[\leadsto \color{blue}{\frac{b}{c}} \]

    if -1.35e18 < c < 1.1500000000000001e99

    1. Initial program 71.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/66.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-166.0%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified66.0%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.35 \cdot 10^{+18}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.15 \cdot 10^{+99}:\\ \;\;\;\;-\frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]

Alternative 12: 42.5% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \frac{b}{c} \end{array} \]
(FPCore (a b c d) :precision binary64 (/ b c))
double code(double a, double b, double c, double d) {
	return b / c;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = b / c
end function
public static double code(double a, double b, double c, double d) {
	return b / c;
}
def code(a, b, c, d):
	return b / c
function code(a, b, c, d)
	return Float64(b / c)
end
function tmp = code(a, b, c, d)
	tmp = b / c;
end
code[a_, b_, c_, d_] := N[(b / c), $MachinePrecision]
\begin{array}{l}

\\
\frac{b}{c}
\end{array}
Derivation
  1. Initial program 58.6%

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

    \[\leadsto \color{blue}{\frac{b}{c}} \]
  3. Final simplification39.7%

    \[\leadsto \frac{b}{c} \]

Developer target: 99.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \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} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (< (fabs d) (fabs c))
   (/ (- b (* a (/ d c))) (+ c (* d (/ d c))))
   (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (fabs(d) < fabs(c)) {
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
	} else {
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: tmp
    if (abs(d) < abs(c)) then
        tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
    else
        tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (Math.abs(d) < Math.abs(c)) {
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
	} else {
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if math.fabs(d) < math.fabs(c):
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
	else:
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (abs(d) < abs(c))
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c))));
	else
		tmp = Float64(Float64(Float64(-a) + Float64(b * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d))));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (abs(d) < abs(c))
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
	else
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) + N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\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}
\end{array}

Reproduce

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