Complex division, imag part

Percentage Accurate: 61.8% → 92.5%
Time: 12.5s
Alternatives: 15
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 15 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: 61.8% 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.5% accurate, 0.0× speedup?

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

\\
\begin{array}{l}
t_0 := \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)\\
t_1 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \frac{a}{d}\\
\mathbf{if}\;d \leq -1.75 \cdot 10^{+155}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;d \leq -1.15 \cdot 10^{-135}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;d \leq 3.55 \cdot 10^{+90}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.74999999999999992e155 or 3.54999999999999988e90 < d

    1. Initial program 36.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub36.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. sub-neg36.6%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      3. *-un-lft-identity36.6%

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

        \[\leadsto \frac{1 \cdot \left(b \cdot c\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      5. times-frac36.6%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b \cdot c}{\sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      6. fma-def36.6%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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) \]
      11. pow250.4%

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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-rr50.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)} \]
    4. Step-by-step derivation
      1. fma-neg50.4%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}} \]
      2. *-commutative50.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\color{blue}{c \cdot b}}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      3. associate-/l*52.2%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}}} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      4. associate-/r/51.0%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \color{blue}{\frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \cdot d} \]
      5. *-commutative51.0%

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

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

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

    if -1.74999999999999992e155 < d < -1.15e-135 or 5.79999999999999961e-180 < d < 3.54999999999999988e90

    1. Initial program 77.5%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub76.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. sub-neg76.7%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      3. *-commutative76.7%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      4. add-sqr-sqrt76.7%

        \[\leadsto \frac{c \cdot b}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      5. times-frac78.8%

        \[\leadsto \color{blue}{\frac{c}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b}{\sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      6. fma-def78.8%

        \[\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)} \]
      7. hypot-def78.8%

        \[\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) \]
      8. hypot-def90.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) \]
      9. associate-/l*95.8%

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

        \[\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) \]
      11. pow295.8%

        \[\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) \]
      12. hypot-def95.8%

        \[\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-rr95.8%

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

    if -1.15e-135 < d < 5.79999999999999961e-180

    1. Initial program 71.7%

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

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

        \[\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-frac71.8%

        \[\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-def71.9%

        \[\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-def84.7%

        \[\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-rr84.7%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-150.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg50.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.75 \cdot 10^{+155}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \frac{a}{d}\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-135}:\\ \;\;\;\;\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 5.8 \cdot 10^{-180}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 3.55 \cdot 10^{+90}:\\ \;\;\;\;\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}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \frac{a}{d}\\ \end{array} \]

Alternative 2: 90.2% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}}\\ t_1 := t_0 - d \cdot \frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\\ t_2 := t_0 - \frac{a}{d}\\ \mathbf{if}\;d \leq -4.1 \cdot 10^{+89}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -1.55 \cdot 10^{-69}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 2.95 \cdot 10^{-170}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 1.85 \cdot 10^{+90}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (* (/ 1.0 (hypot c d)) (/ c (/ (hypot c d) b))))
        (t_1 (- t_0 (* d (/ a (pow (hypot c d) 2.0)))))
        (t_2 (- t_0 (/ a d))))
   (if (<= d -4.1e+89)
     t_2
     (if (<= d -1.55e-69)
       t_1
       (if (<= d 2.95e-170)
         (* (/ -1.0 c) (- (/ a (/ c d)) b))
         (if (<= d 1.85e+90) t_1 t_2))))))
double code(double a, double b, double c, double d) {
	double t_0 = (1.0 / hypot(c, d)) * (c / (hypot(c, d) / b));
	double t_1 = t_0 - (d * (a / pow(hypot(c, d), 2.0)));
	double t_2 = t_0 - (a / d);
	double tmp;
	if (d <= -4.1e+89) {
		tmp = t_2;
	} else if (d <= -1.55e-69) {
		tmp = t_1;
	} else if (d <= 2.95e-170) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 1.85e+90) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double a, double b, double c, double d) {
	double t_0 = (1.0 / Math.hypot(c, d)) * (c / (Math.hypot(c, d) / b));
	double t_1 = t_0 - (d * (a / Math.pow(Math.hypot(c, d), 2.0)));
	double t_2 = t_0 - (a / d);
	double tmp;
	if (d <= -4.1e+89) {
		tmp = t_2;
	} else if (d <= -1.55e-69) {
		tmp = t_1;
	} else if (d <= 2.95e-170) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 1.85e+90) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (1.0 / math.hypot(c, d)) * (c / (math.hypot(c, d) / b))
	t_1 = t_0 - (d * (a / math.pow(math.hypot(c, d), 2.0)))
	t_2 = t_0 - (a / d)
	tmp = 0
	if d <= -4.1e+89:
		tmp = t_2
	elif d <= -1.55e-69:
		tmp = t_1
	elif d <= 2.95e-170:
		tmp = (-1.0 / c) * ((a / (c / d)) - b)
	elif d <= 1.85e+90:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(1.0 / hypot(c, d)) * Float64(c / Float64(hypot(c, d) / b)))
	t_1 = Float64(t_0 - Float64(d * Float64(a / (hypot(c, d) ^ 2.0))))
	t_2 = Float64(t_0 - Float64(a / d))
	tmp = 0.0
	if (d <= -4.1e+89)
		tmp = t_2;
	elseif (d <= -1.55e-69)
		tmp = t_1;
	elseif (d <= 2.95e-170)
		tmp = Float64(Float64(-1.0 / c) * Float64(Float64(a / Float64(c / d)) - b));
	elseif (d <= 1.85e+90)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (1.0 / hypot(c, d)) * (c / (hypot(c, d) / b));
	t_1 = t_0 - (d * (a / (hypot(c, d) ^ 2.0)));
	t_2 = t_0 - (a / d);
	tmp = 0.0;
	if (d <= -4.1e+89)
		tmp = t_2;
	elseif (d <= -1.55e-69)
		tmp = t_1;
	elseif (d <= 2.95e-170)
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	elseif (d <= 1.85e+90)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(c / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(d * N[(a / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - N[(a / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.1e+89], t$95$2, If[LessEqual[d, -1.55e-69], t$95$1, If[LessEqual[d, 2.95e-170], N[(N[(-1.0 / c), $MachinePrecision] * N[(N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.85e+90], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -1.55 \cdot 10^{-69}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;d \leq 1.85 \cdot 10^{+90}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -4.09999999999999985e89 or 1.85e90 < d

    1. Initial program 45.0%

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

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

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      3. *-un-lft-identity45.0%

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

        \[\leadsto \frac{1 \cdot \left(b \cdot c\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      5. times-frac45.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{c \cdot c + d \cdot d}} \cdot \frac{b \cdot c}{\sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      6. fma-def45.0%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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) \]
      11. pow257.9%

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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-rr57.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)} \]
    4. Step-by-step derivation
      1. fma-neg57.9%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}} \]
      2. *-commutative57.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\color{blue}{c \cdot b}}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      3. associate-/l*59.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}}} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      4. associate-/r/57.2%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \color{blue}{\frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \cdot d} \]
      5. *-commutative57.2%

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

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

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

    if -4.09999999999999985e89 < d < -1.55e-69 or 2.9499999999999999e-170 < d < 1.85e90

    1. Initial program 75.0%

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

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

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      3. *-un-lft-identity74.0%

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

        \[\leadsto \frac{1 \cdot \left(b \cdot c\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      5. times-frac73.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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) \]
      11. pow285.2%

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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-rr85.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)} \]
    4. Step-by-step derivation
      1. fma-neg85.2%

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\color{blue}{c \cdot b}}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      3. associate-/l*95.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}}} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      4. associate-/r/93.2%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \color{blue}{\frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \cdot d} \]
      5. *-commutative93.2%

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

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

    if -1.55e-69 < d < 2.9499999999999999e-170

    1. Initial program 73.2%

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

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

        \[\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-frac73.2%

        \[\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-def73.2%

        \[\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-def84.3%

        \[\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-rr84.3%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-151.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg51.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.1 \cdot 10^{+89}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \frac{a}{d}\\ \mathbf{elif}\;d \leq -1.55 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - d \cdot \frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\\ \mathbf{elif}\;d \leq 2.95 \cdot 10^{-170}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 1.85 \cdot 10^{+90}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - d \cdot \frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \frac{a}{d}\\ \end{array} \]

Alternative 3: 85.6% accurate, 0.1× 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 5 \cdot 10^{+280}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\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))) 5e+280)
     (* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
     (* (/ -1.0 c) (- (/ a (/ c d)) b)))))
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))) <= 5e+280) {
		tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
	} else {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	}
	return tmp;
}
public static 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))) <= 5e+280) {
		tmp = (1.0 / Math.hypot(c, d)) * (t_0 / Math.hypot(c, d));
	} else {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (c * b) - (d * a)
	tmp = 0
	if (t_0 / ((c * c) + (d * d))) <= 5e+280:
		tmp = (1.0 / math.hypot(c, d)) * (t_0 / math.hypot(c, d))
	else:
		tmp = (-1.0 / c) * ((a / (c / d)) - b)
	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))) <= 5e+280)
		tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d)));
	else
		tmp = Float64(Float64(-1.0 / c) * Float64(Float64(a / Float64(c / d)) - b));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (c * b) - (d * a);
	tmp = 0.0;
	if ((t_0 / ((c * c) + (d * d))) <= 5e+280)
		tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
	else
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	end
	tmp_2 = 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], 5e+280], 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[(-1.0 / c), $MachinePrecision] * N[(N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision] - b), $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 5 \cdot 10^{+280}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\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))) < 5.0000000000000002e280

    1. Initial program 80.0%

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

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

        \[\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-frac80.0%

        \[\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-def80.0%

        \[\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-def96.7%

        \[\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-rr96.7%

      \[\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 5.0000000000000002e280 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d)))

    1. Initial program 16.6%

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

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

        \[\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-frac16.6%

        \[\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-def16.6%

        \[\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-def24.3%

        \[\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-rr24.3%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-132.9%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg32.9%

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{c}} \cdot \left(\frac{a}{\frac{c}{d}} - b\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.4%

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

Alternative 4: 88.9% accurate, 0.1× speedup?

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

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

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


\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))) < 5.0000000000000002e280

    1. Initial program 80.0%

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

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

        \[\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-frac80.0%

        \[\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-def80.0%

        \[\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-def96.7%

        \[\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-rr96.7%

      \[\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 5.0000000000000002e280 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d)))

    1. Initial program 16.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub6.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. sub-neg6.7%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      3. *-un-lft-identity6.7%

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

        \[\leadsto \frac{1 \cdot \left(b \cdot c\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      5. times-frac6.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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) \]
      11. pow215.5%

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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-rr15.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)} \]
    4. Step-by-step derivation
      1. fma-neg15.5%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}} \]
      2. *-commutative15.5%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\color{blue}{c \cdot b}}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      3. associate-/l*50.7%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}}} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      4. associate-/r/50.7%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \color{blue}{\frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \cdot d} \]
      5. *-commutative50.7%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \color{blue}{d \cdot \frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
    5. Simplified50.7%

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

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

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

Alternative 5: 89.0% accurate, 0.1× speedup?

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

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

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


\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))) < 5.0000000000000002e280

    1. Initial program 80.0%

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

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

        \[\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-frac80.0%

        \[\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-def80.0%

        \[\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-def96.7%

        \[\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-rr96.7%

      \[\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)}} \]
    4. Step-by-step derivation
      1. associate-*l/96.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}} \]
      2. *-un-lft-identity96.8%

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

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

        \[\leadsto \frac{-\frac{\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-in96.8%

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

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)}} \]
    6. Step-by-step derivation
      1. distribute-neg-frac96.8%

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

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

        \[\leadsto \frac{\frac{-\color{blue}{\left(a \cdot \left(-d\right) + b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      4. distribute-neg-in96.8%

        \[\leadsto \frac{\frac{\color{blue}{\left(-a \cdot \left(-d\right)\right) + \left(-b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-out96.8%

        \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-a \cdot d\right)}\right) + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      6. remove-double-neg96.8%

        \[\leadsto \frac{\frac{\color{blue}{a \cdot d} + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      7. *-commutative96.8%

        \[\leadsto \frac{\frac{a \cdot d + \left(-\color{blue}{c \cdot b}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      8. distribute-rgt-neg-in96.8%

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

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

    if 5.0000000000000002e280 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d)))

    1. Initial program 16.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. div-sub6.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. sub-neg6.7%

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right)} \]
      3. *-un-lft-identity6.7%

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

        \[\leadsto \frac{1 \cdot \left(b \cdot c\right)}{\color{blue}{\sqrt{c \cdot c + d \cdot d} \cdot \sqrt{c \cdot c + d \cdot d}}} + \left(-\frac{a \cdot d}{c \cdot c + d \cdot d}\right) \]
      5. times-frac6.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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) \]
      11. pow215.5%

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\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-rr15.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(c, d\right)}, \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}\right)} \]
    4. Step-by-step derivation
      1. fma-neg15.5%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}}} \]
      2. *-commutative15.5%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\color{blue}{c \cdot b}}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      3. associate-/l*50.7%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}}} - \frac{a}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{d}} \]
      4. associate-/r/50.7%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \color{blue}{\frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \cdot d} \]
      5. *-commutative50.7%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \color{blue}{d \cdot \frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
    5. Simplified50.7%

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

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

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

Alternative 6: 82.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(c \cdot b - d \cdot a\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2}\\ t_1 := \frac{b}{\frac{d}{c}}\\ t_2 := -\mathsf{hypot}\left(c, d\right)\\ \mathbf{if}\;d \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;\frac{t_1 - a}{t_2}\\ \mathbf{elif}\;d \leq -6.9 \cdot 10^{-74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 6.8 \cdot 10^{-105}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{a - t_1}{t_2}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (* (- (* c b) (* d a)) (pow (hypot c d) -2.0)))
        (t_1 (/ b (/ d c)))
        (t_2 (- (hypot c d))))
   (if (<= d -3.4e+143)
     (/ (- t_1 a) t_2)
     (if (<= d -6.9e-74)
       t_0
       (if (<= d 6.8e-105)
         (* (/ -1.0 c) (- (/ a (/ c d)) b))
         (if (<= d 7.5e+28) t_0 (/ (- a t_1) t_2)))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((c * b) - (d * a)) * pow(hypot(c, d), -2.0);
	double t_1 = b / (d / c);
	double t_2 = -hypot(c, d);
	double tmp;
	if (d <= -3.4e+143) {
		tmp = (t_1 - a) / t_2;
	} else if (d <= -6.9e-74) {
		tmp = t_0;
	} else if (d <= 6.8e-105) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 7.5e+28) {
		tmp = t_0;
	} else {
		tmp = (a - t_1) / t_2;
	}
	return tmp;
}
public static double code(double a, double b, double c, double d) {
	double t_0 = ((c * b) - (d * a)) * Math.pow(Math.hypot(c, d), -2.0);
	double t_1 = b / (d / c);
	double t_2 = -Math.hypot(c, d);
	double tmp;
	if (d <= -3.4e+143) {
		tmp = (t_1 - a) / t_2;
	} else if (d <= -6.9e-74) {
		tmp = t_0;
	} else if (d <= 6.8e-105) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 7.5e+28) {
		tmp = t_0;
	} else {
		tmp = (a - t_1) / t_2;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((c * b) - (d * a)) * math.pow(math.hypot(c, d), -2.0)
	t_1 = b / (d / c)
	t_2 = -math.hypot(c, d)
	tmp = 0
	if d <= -3.4e+143:
		tmp = (t_1 - a) / t_2
	elif d <= -6.9e-74:
		tmp = t_0
	elif d <= 6.8e-105:
		tmp = (-1.0 / c) * ((a / (c / d)) - b)
	elif d <= 7.5e+28:
		tmp = t_0
	else:
		tmp = (a - t_1) / t_2
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) * (hypot(c, d) ^ -2.0))
	t_1 = Float64(b / Float64(d / c))
	t_2 = Float64(-hypot(c, d))
	tmp = 0.0
	if (d <= -3.4e+143)
		tmp = Float64(Float64(t_1 - a) / t_2);
	elseif (d <= -6.9e-74)
		tmp = t_0;
	elseif (d <= 6.8e-105)
		tmp = Float64(Float64(-1.0 / c) * Float64(Float64(a / Float64(c / d)) - b));
	elseif (d <= 7.5e+28)
		tmp = t_0;
	else
		tmp = Float64(Float64(a - t_1) / t_2);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((c * b) - (d * a)) * (hypot(c, d) ^ -2.0);
	t_1 = b / (d / c);
	t_2 = -hypot(c, d);
	tmp = 0.0;
	if (d <= -3.4e+143)
		tmp = (t_1 - a) / t_2;
	elseif (d <= -6.9e-74)
		tmp = t_0;
	elseif (d <= 6.8e-105)
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	elseif (d <= 7.5e+28)
		tmp = t_0;
	else
		tmp = (a - t_1) / t_2;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] * N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision])}, If[LessEqual[d, -3.4e+143], N[(N[(t$95$1 - a), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[d, -6.9e-74], t$95$0, If[LessEqual[d, 6.8e-105], N[(N[(-1.0 / c), $MachinePrecision] * N[(N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.5e+28], t$95$0, N[(N[(a - t$95$1), $MachinePrecision] / t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -6.9 \cdot 10^{-74}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;d \leq 7.5 \cdot 10^{+28}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{a - t_1}{t_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -3.39999999999999982e143

    1. Initial program 39.9%

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

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

        \[\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-frac40.0%

        \[\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-def40.0%

        \[\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-def72.0%

        \[\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-rr72.0%

      \[\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)}} \]
    4. Step-by-step derivation
      1. associate-*l/72.0%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}} \]
      2. *-un-lft-identity72.0%

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

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

        \[\leadsto \frac{-\frac{\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-in72.1%

        \[\leadsto \frac{-\frac{\mathsf{fma}\left(b, c, \color{blue}{a \cdot \left(-d\right)}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
    5. Applied egg-rr72.1%

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)}} \]
    6. Step-by-step derivation
      1. distribute-neg-frac72.1%

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

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

        \[\leadsto \frac{\frac{-\color{blue}{\left(a \cdot \left(-d\right) + b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      4. distribute-neg-in72.0%

        \[\leadsto \frac{\frac{\color{blue}{\left(-a \cdot \left(-d\right)\right) + \left(-b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-out72.0%

        \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-a \cdot d\right)}\right) + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      6. remove-double-neg72.0%

        \[\leadsto \frac{\frac{\color{blue}{a \cdot d} + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      7. *-commutative72.0%

        \[\leadsto \frac{\frac{a \cdot d + \left(-\color{blue}{c \cdot b}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      8. distribute-rgt-neg-in72.0%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d} + -1 \cdot a}}{-\mathsf{hypot}\left(c, d\right)} \]
      2. mul-1-neg91.8%

        \[\leadsto \frac{\frac{b \cdot c}{d} + \color{blue}{\left(-a\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      3. unsub-neg91.8%

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

        \[\leadsto \frac{\color{blue}{\frac{b}{\frac{d}{c}}} - a}{-\mathsf{hypot}\left(c, d\right)} \]
    10. Simplified92.0%

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

    if -3.39999999999999982e143 < d < -6.89999999999999981e-74 or 6.79999999999999984e-105 < d < 7.4999999999999998e28

    1. Initial program 82.9%

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

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

        \[\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-frac82.7%

        \[\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-def82.7%

        \[\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-def87.8%

        \[\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-rr87.8%

      \[\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)}} \]
    4. Step-by-step derivation
      1. frac-times82.9%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(b \cdot c - a \cdot d\right)}{\mathsf{hypot}\left(c, d\right) \cdot \mathsf{hypot}\left(c, d\right)}} \]
      2. *-un-lft-identity82.9%

        \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{\mathsf{hypot}\left(c, d\right) \cdot \mathsf{hypot}\left(c, d\right)} \]
      3. *-commutative82.9%

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

        \[\leadsto \frac{c \cdot b - a \cdot d}{\color{blue}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
      5. expm1-log1p-u66.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c \cdot b - a \cdot d}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\right)} \]
      6. expm1-udef37.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c \cdot b - a \cdot d}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)} - 1} \]
      7. div-inv37.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(c \cdot b - a \cdot d\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}}\right)} - 1 \]
      8. *-commutative37.1%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{b \cdot c} - a \cdot d\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)} - 1 \]
      9. fma-neg37.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)} - 1 \]
      10. distribute-rgt-neg-in37.1%

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

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right) \cdot \color{blue}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{\left(-2\right)}}\right)} - 1 \]
      12. metadata-eval37.1%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{\color{blue}{-2}}\right)} - 1 \]
    5. Applied egg-rr37.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def66.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2}\right)\right)} \]
      2. expm1-log1p83.0%

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

        \[\leadsto \color{blue}{\left(b \cdot c + a \cdot \left(-d\right)\right)} \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2} \]
      4. distribute-rgt-neg-out83.0%

        \[\leadsto \left(b \cdot c + \color{blue}{\left(-a \cdot d\right)}\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2} \]
      5. unsub-neg83.0%

        \[\leadsto \color{blue}{\left(b \cdot c - a \cdot d\right)} \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2} \]
      6. *-commutative83.0%

        \[\leadsto \left(\color{blue}{c \cdot b} - a \cdot d\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2} \]
    7. Simplified83.0%

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

    if -6.89999999999999981e-74 < d < 6.79999999999999984e-105

    1. Initial program 70.3%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt70.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-frac70.4%

        \[\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-def70.4%

        \[\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-def81.1%

        \[\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-rr81.1%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-146.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg46.4%

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

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

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

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

    if 7.4999999999999998e28 < d

    1. Initial program 46.5%

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

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

        \[\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-frac46.4%

        \[\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-def46.4%

        \[\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-def68.0%

        \[\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-rr68.0%

      \[\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)}} \]
    4. Step-by-step derivation
      1. associate-*l/68.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}} \]
      2. *-un-lft-identity68.1%

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

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

        \[\leadsto \frac{-\frac{\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-in68.2%

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

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)}} \]
    6. Step-by-step derivation
      1. distribute-neg-frac68.2%

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

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

        \[\leadsto \frac{\frac{-\color{blue}{\left(a \cdot \left(-d\right) + b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      4. distribute-neg-in68.1%

        \[\leadsto \frac{\frac{\color{blue}{\left(-a \cdot \left(-d\right)\right) + \left(-b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-out68.1%

        \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-a \cdot d\right)}\right) + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      6. remove-double-neg68.1%

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

        \[\leadsto \frac{\frac{a \cdot d + \left(-\color{blue}{c \cdot b}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      8. distribute-rgt-neg-in68.1%

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

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

      \[\leadsto \frac{\color{blue}{a + -1 \cdot \frac{b \cdot c}{d}}}{-\mathsf{hypot}\left(c, d\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg88.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{-\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq -6.9 \cdot 10^{-74}:\\ \;\;\;\;\left(c \cdot b - d \cdot a\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2}\\ \mathbf{elif}\;d \leq 6.8 \cdot 10^{-105}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;\left(c \cdot b - d \cdot a\right) \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a - \frac{b}{\frac{d}{c}}}{-\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]

Alternative 7: 81.1% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;d \leq -1.45 \cdot 10^{-69}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;d \leq 7.5 \cdot 10^{+28}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -6.1999999999999998e143

    1. Initial program 39.9%

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

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

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

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

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

    if -6.1999999999999998e143 < d < -1.4499999999999999e-69 or 4.7999999999999995e-106 < d < 7.4999999999999998e28

    1. Initial program 82.4%

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

    if -1.4499999999999999e-69 < d < 4.7999999999999995e-106

    1. Initial program 70.9%

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

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

        \[\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-frac71.0%

        \[\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-def71.0%

        \[\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-def81.5%

        \[\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-rr81.5%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-147.6%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg47.6%

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

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

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

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

    if 7.4999999999999998e28 < d

    1. Initial program 46.5%

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

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

        \[\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-frac46.4%

        \[\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-def46.4%

        \[\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-def68.0%

        \[\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-rr68.0%

      \[\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)}} \]
    4. Step-by-step derivation
      1. associate-*l/68.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}} \]
      2. *-un-lft-identity68.1%

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

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

        \[\leadsto \frac{-\frac{\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-in68.2%

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

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)}} \]
    6. Step-by-step derivation
      1. distribute-neg-frac68.2%

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

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

        \[\leadsto \frac{\frac{-\color{blue}{\left(a \cdot \left(-d\right) + b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      4. distribute-neg-in68.1%

        \[\leadsto \frac{\frac{\color{blue}{\left(-a \cdot \left(-d\right)\right) + \left(-b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-out68.1%

        \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-a \cdot d\right)}\right) + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      6. remove-double-neg68.1%

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

        \[\leadsto \frac{\frac{a \cdot d + \left(-\color{blue}{c \cdot b}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      8. distribute-rgt-neg-in68.1%

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

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

      \[\leadsto \frac{\color{blue}{a + -1 \cdot \frac{b \cdot c}{d}}}{-\mathsf{hypot}\left(c, d\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg88.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -6.2 \cdot 10^{+143}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -1.45 \cdot 10^{-69}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 4.8 \cdot 10^{-106}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a - \frac{b}{\frac{d}{c}}}{-\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]

Alternative 8: 82.4% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;d \leq -1.45 \cdot 10^{-69}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;d \leq 7.5 \cdot 10^{+28}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{a - t_1}{t_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -3.39999999999999982e143

    1. Initial program 39.9%

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

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

        \[\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-frac40.0%

        \[\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-def40.0%

        \[\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-def72.0%

        \[\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-rr72.0%

      \[\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)}} \]
    4. Step-by-step derivation
      1. associate-*l/72.0%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}} \]
      2. *-un-lft-identity72.0%

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

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

        \[\leadsto \frac{-\frac{\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-in72.1%

        \[\leadsto \frac{-\frac{\mathsf{fma}\left(b, c, \color{blue}{a \cdot \left(-d\right)}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
    5. Applied egg-rr72.1%

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)}} \]
    6. Step-by-step derivation
      1. distribute-neg-frac72.1%

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

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

        \[\leadsto \frac{\frac{-\color{blue}{\left(a \cdot \left(-d\right) + b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      4. distribute-neg-in72.0%

        \[\leadsto \frac{\frac{\color{blue}{\left(-a \cdot \left(-d\right)\right) + \left(-b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-out72.0%

        \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-a \cdot d\right)}\right) + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      6. remove-double-neg72.0%

        \[\leadsto \frac{\frac{\color{blue}{a \cdot d} + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      7. *-commutative72.0%

        \[\leadsto \frac{\frac{a \cdot d + \left(-\color{blue}{c \cdot b}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      8. distribute-rgt-neg-in72.0%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d} + -1 \cdot a}}{-\mathsf{hypot}\left(c, d\right)} \]
      2. mul-1-neg91.8%

        \[\leadsto \frac{\frac{b \cdot c}{d} + \color{blue}{\left(-a\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      3. unsub-neg91.8%

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

        \[\leadsto \frac{\color{blue}{\frac{b}{\frac{d}{c}}} - a}{-\mathsf{hypot}\left(c, d\right)} \]
    10. Simplified92.0%

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

    if -3.39999999999999982e143 < d < -1.4499999999999999e-69 or 1.10000000000000006e-104 < d < 7.4999999999999998e28

    1. Initial program 82.4%

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

    if -1.4499999999999999e-69 < d < 1.10000000000000006e-104

    1. Initial program 70.9%

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

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

        \[\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-frac71.0%

        \[\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-def71.0%

        \[\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-def81.5%

        \[\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-rr81.5%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-147.6%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg47.6%

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

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

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

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

    if 7.4999999999999998e28 < d

    1. Initial program 46.5%

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

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

        \[\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-frac46.4%

        \[\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-def46.4%

        \[\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-def68.0%

        \[\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-rr68.0%

      \[\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)}} \]
    4. Step-by-step derivation
      1. associate-*l/68.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}} \]
      2. *-un-lft-identity68.1%

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

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

        \[\leadsto \frac{-\frac{\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-in68.2%

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

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)}} \]
    6. Step-by-step derivation
      1. distribute-neg-frac68.2%

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

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

        \[\leadsto \frac{\frac{-\color{blue}{\left(a \cdot \left(-d\right) + b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      4. distribute-neg-in68.1%

        \[\leadsto \frac{\frac{\color{blue}{\left(-a \cdot \left(-d\right)\right) + \left(-b \cdot c\right)}}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-out68.1%

        \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-a \cdot d\right)}\right) + \left(-b \cdot c\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      6. remove-double-neg68.1%

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

        \[\leadsto \frac{\frac{a \cdot d + \left(-\color{blue}{c \cdot b}\right)}{\mathsf{hypot}\left(c, d\right)}}{-\mathsf{hypot}\left(c, d\right)} \]
      8. distribute-rgt-neg-in68.1%

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

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

      \[\leadsto \frac{\color{blue}{a + -1 \cdot \frac{b \cdot c}{d}}}{-\mathsf{hypot}\left(c, d\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg88.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{-\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq -1.45 \cdot 10^{-69}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.1 \cdot 10^{-104}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a - \frac{b}{\frac{d}{c}}}{-\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]

Alternative 9: 79.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;d \leq -6.2 \cdot 10^{+143}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -1.65 \cdot 10^{-69}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.18 \cdot 10^{-105}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{+28}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{\frac{{d}^{2}}{c}} - \frac{a}{d}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
   (if (<= d -6.2e+143)
     (/ (- a) d)
     (if (<= d -1.65e-69)
       t_0
       (if (<= d 1.18e-105)
         (* (/ -1.0 c) (- (/ a (/ c d)) b))
         (if (<= d 1.8e+28) t_0 (- (/ b (/ (pow d 2.0) c)) (/ a d))))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
	double tmp;
	if (d <= -6.2e+143) {
		tmp = -a / d;
	} else if (d <= -1.65e-69) {
		tmp = t_0;
	} else if (d <= 1.18e-105) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 1.8e+28) {
		tmp = t_0;
	} else {
		tmp = (b / (pow(d, 2.0) / c)) - (a / 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) :: t_0
    real(8) :: tmp
    t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
    if (d <= (-6.2d+143)) then
        tmp = -a / d
    else if (d <= (-1.65d-69)) then
        tmp = t_0
    else if (d <= 1.18d-105) then
        tmp = ((-1.0d0) / c) * ((a / (c / d)) - b)
    else if (d <= 1.8d+28) then
        tmp = t_0
    else
        tmp = (b / ((d ** 2.0d0) / c)) - (a / d)
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
	double tmp;
	if (d <= -6.2e+143) {
		tmp = -a / d;
	} else if (d <= -1.65e-69) {
		tmp = t_0;
	} else if (d <= 1.18e-105) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 1.8e+28) {
		tmp = t_0;
	} else {
		tmp = (b / (Math.pow(d, 2.0) / c)) - (a / d);
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
	tmp = 0
	if d <= -6.2e+143:
		tmp = -a / d
	elif d <= -1.65e-69:
		tmp = t_0
	elif d <= 1.18e-105:
		tmp = (-1.0 / c) * ((a / (c / d)) - b)
	elif d <= 1.8e+28:
		tmp = t_0
	else:
		tmp = (b / (math.pow(d, 2.0) / c)) - (a / d)
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d)))
	tmp = 0.0
	if (d <= -6.2e+143)
		tmp = Float64(Float64(-a) / d);
	elseif (d <= -1.65e-69)
		tmp = t_0;
	elseif (d <= 1.18e-105)
		tmp = Float64(Float64(-1.0 / c) * Float64(Float64(a / Float64(c / d)) - b));
	elseif (d <= 1.8e+28)
		tmp = t_0;
	else
		tmp = Float64(Float64(b / Float64((d ^ 2.0) / c)) - Float64(a / d));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
	tmp = 0.0;
	if (d <= -6.2e+143)
		tmp = -a / d;
	elseif (d <= -1.65e-69)
		tmp = t_0;
	elseif (d <= 1.18e-105)
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	elseif (d <= 1.8e+28)
		tmp = t_0;
	else
		tmp = (b / ((d ^ 2.0) / c)) - (a / d);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.2e+143], N[((-a) / d), $MachinePrecision], If[LessEqual[d, -1.65e-69], t$95$0, If[LessEqual[d, 1.18e-105], N[(N[(-1.0 / c), $MachinePrecision] * N[(N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e+28], t$95$0, N[(N[(b / N[(N[Power[d, 2.0], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -1.65 \cdot 10^{-69}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;d \leq 1.8 \cdot 10^{+28}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -6.1999999999999998e143

    1. Initial program 39.9%

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

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

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

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

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

    if -6.1999999999999998e143 < d < -1.65e-69 or 1.1799999999999999e-105 < d < 1.8e28

    1. Initial program 82.4%

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

    if -1.65e-69 < d < 1.1799999999999999e-105

    1. Initial program 70.9%

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

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

        \[\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-frac71.0%

        \[\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-def71.0%

        \[\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-def81.5%

        \[\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-rr81.5%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-147.6%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg47.6%

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

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

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

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

    if 1.8e28 < d

    1. Initial program 46.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -6.2 \cdot 10^{+143}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -1.65 \cdot 10^{-69}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.18 \cdot 10^{-105}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{+28}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{\frac{{d}^{2}}{c}} - \frac{a}{d}\\ \end{array} \]

Alternative 10: 79.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ t_1 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;d \leq -1.05 \cdot 10^{+144}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -1.45 \cdot 10^{-69}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{-105}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 1.72 \cdot 10^{+130}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- a) d)) (t_1 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
   (if (<= d -1.05e+144)
     t_0
     (if (<= d -1.45e-69)
       t_1
       (if (<= d 1.45e-105)
         (* (/ -1.0 c) (- (/ a (/ c d)) b))
         (if (<= d 1.72e+130) t_1 t_0))))))
double code(double a, double b, double c, double d) {
	double t_0 = -a / d;
	double t_1 = ((c * b) - (d * a)) / ((c * c) + (d * d));
	double tmp;
	if (d <= -1.05e+144) {
		tmp = t_0;
	} else if (d <= -1.45e-69) {
		tmp = t_1;
	} else if (d <= 1.45e-105) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 1.72e+130) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = -a / d
    t_1 = ((c * b) - (d * a)) / ((c * c) + (d * d))
    if (d <= (-1.05d+144)) then
        tmp = t_0
    else if (d <= (-1.45d-69)) then
        tmp = t_1
    else if (d <= 1.45d-105) then
        tmp = ((-1.0d0) / c) * ((a / (c / d)) - b)
    else if (d <= 1.72d+130) then
        tmp = t_1
    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 = -a / d;
	double t_1 = ((c * b) - (d * a)) / ((c * c) + (d * d));
	double tmp;
	if (d <= -1.05e+144) {
		tmp = t_0;
	} else if (d <= -1.45e-69) {
		tmp = t_1;
	} else if (d <= 1.45e-105) {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	} else if (d <= 1.72e+130) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = -a / d
	t_1 = ((c * b) - (d * a)) / ((c * c) + (d * d))
	tmp = 0
	if d <= -1.05e+144:
		tmp = t_0
	elif d <= -1.45e-69:
		tmp = t_1
	elif d <= 1.45e-105:
		tmp = (-1.0 / c) * ((a / (c / d)) - b)
	elif d <= 1.72e+130:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(-a) / d)
	t_1 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d)))
	tmp = 0.0
	if (d <= -1.05e+144)
		tmp = t_0;
	elseif (d <= -1.45e-69)
		tmp = t_1;
	elseif (d <= 1.45e-105)
		tmp = Float64(Float64(-1.0 / c) * Float64(Float64(a / Float64(c / d)) - b));
	elseif (d <= 1.72e+130)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = -a / d;
	t_1 = ((c * b) - (d * a)) / ((c * c) + (d * d));
	tmp = 0.0;
	if (d <= -1.05e+144)
		tmp = t_0;
	elseif (d <= -1.45e-69)
		tmp = t_1;
	elseif (d <= 1.45e-105)
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	elseif (d <= 1.72e+130)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.05e+144], t$95$0, If[LessEqual[d, -1.45e-69], t$95$1, If[LessEqual[d, 1.45e-105], N[(N[(-1.0 / c), $MachinePrecision] * N[(N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.72e+130], t$95$1, t$95$0]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -1.45 \cdot 10^{-69}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;d \leq 1.72 \cdot 10^{+130}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.04999999999999998e144 or 1.72000000000000008e130 < d

    1. Initial program 36.1%

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

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

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

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

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

    if -1.04999999999999998e144 < d < -1.4499999999999999e-69 or 1.45000000000000002e-105 < d < 1.72000000000000008e130

    1. Initial program 80.8%

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

    if -1.4499999999999999e-69 < d < 1.45000000000000002e-105

    1. Initial program 70.9%

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

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

        \[\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-frac71.0%

        \[\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-def71.0%

        \[\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-def81.5%

        \[\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-rr81.5%

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-147.6%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg47.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.05 \cdot 10^{+144}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -1.45 \cdot 10^{-69}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{-105}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \mathbf{elif}\;d \leq 1.72 \cdot 10^{+130}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]

Alternative 11: 70.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{-31} \lor \neg \left(d \leq 3.25 \cdot 10^{-68}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (or (<= d -1.4e-31) (not (<= d 3.25e-68)))
   (/ (- a) d)
   (* (/ -1.0 c) (- (/ a (/ c d)) b))))
double code(double a, double b, double c, double d) {
	double tmp;
	if ((d <= -1.4e-31) || !(d <= 3.25e-68)) {
		tmp = -a / d;
	} else {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	}
	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 ((d <= (-1.4d-31)) .or. (.not. (d <= 3.25d-68))) then
        tmp = -a / d
    else
        tmp = ((-1.0d0) / c) * ((a / (c / d)) - b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if ((d <= -1.4e-31) || !(d <= 3.25e-68)) {
		tmp = -a / d;
	} else {
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if (d <= -1.4e-31) or not (d <= 3.25e-68):
		tmp = -a / d
	else:
		tmp = (-1.0 / c) * ((a / (c / d)) - b)
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if ((d <= -1.4e-31) || !(d <= 3.25e-68))
		tmp = Float64(Float64(-a) / d);
	else
		tmp = Float64(Float64(-1.0 / c) * Float64(Float64(a / Float64(c / d)) - b));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if ((d <= -1.4e-31) || ~((d <= 3.25e-68)))
		tmp = -a / d;
	else
		tmp = (-1.0 / c) * ((a / (c / d)) - b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1.4e-31], N[Not[LessEqual[d, 3.25e-68]], $MachinePrecision]], N[((-a) / d), $MachinePrecision], N[(N[(-1.0 / c), $MachinePrecision] * N[(N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.4 \cdot 10^{-31} \lor \neg \left(d \leq 3.25 \cdot 10^{-68}\right):\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.3999999999999999e-31 or 3.2499999999999999e-68 < d

    1. Initial program 59.3%

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

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

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

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

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

    if -1.3999999999999999e-31 < d < 3.2499999999999999e-68

    1. Initial program 71.0%

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

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

        \[\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-frac71.0%

        \[\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-def71.1%

        \[\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-def82.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-rr82.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)}} \]
    4. Taylor expanded in c around -inf 45.8%

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot d}{c} + -1 \cdot b\right)} \]
      2. neg-mul-145.8%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a \cdot d}{c} + \color{blue}{\left(-b\right)}\right) \]
      3. unsub-neg45.8%

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{c}} \cdot \left(\frac{a}{\frac{c}{d}} - b\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{-31} \lor \neg \left(d \leq 3.25 \cdot 10^{-68}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{c} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\ \end{array} \]

Alternative 12: 62.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -1.92 \cdot 10^{-60} \lor \neg \left(d \leq 1.35 \cdot 10^{-69}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (or (<= d -1.92e-60) (not (<= d 1.35e-69))) (/ (- a) d) (/ b c)))
double code(double a, double b, double c, double d) {
	double tmp;
	if ((d <= -1.92e-60) || !(d <= 1.35e-69)) {
		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 ((d <= (-1.92d-60)) .or. (.not. (d <= 1.35d-69))) 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 ((d <= -1.92e-60) || !(d <= 1.35e-69)) {
		tmp = -a / d;
	} else {
		tmp = b / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if (d <= -1.92e-60) or not (d <= 1.35e-69):
		tmp = -a / d
	else:
		tmp = b / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if ((d <= -1.92e-60) || !(d <= 1.35e-69))
		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 ((d <= -1.92e-60) || ~((d <= 1.35e-69)))
		tmp = -a / d;
	else
		tmp = b / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1.92e-60], N[Not[LessEqual[d, 1.35e-69]], $MachinePrecision]], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.92 \cdot 10^{-60} \lor \neg \left(d \leq 1.35 \cdot 10^{-69}\right):\\
\;\;\;\;\frac{-a}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.9200000000000001e-60 or 1.3499999999999999e-69 < d

    1. Initial program 58.9%

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

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

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

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

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

    if -1.9200000000000001e-60 < d < 1.3499999999999999e-69

    1. Initial program 72.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.92 \cdot 10^{-60} \lor \neg \left(d \leq 1.35 \cdot 10^{-69}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]

Alternative 13: 46.5% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -5.8 \cdot 10^{+129} \lor \neg \left(d \leq 2.8 \cdot 10^{+183}\right):\\ \;\;\;\;\frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (or (<= d -5.8e+129) (not (<= d 2.8e+183))) (/ a d) (/ b c)))
double code(double a, double b, double c, double d) {
	double tmp;
	if ((d <= -5.8e+129) || !(d <= 2.8e+183)) {
		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 ((d <= (-5.8d+129)) .or. (.not. (d <= 2.8d+183))) 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 ((d <= -5.8e+129) || !(d <= 2.8e+183)) {
		tmp = a / d;
	} else {
		tmp = b / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if (d <= -5.8e+129) or not (d <= 2.8e+183):
		tmp = a / d
	else:
		tmp = b / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if ((d <= -5.8e+129) || !(d <= 2.8e+183))
		tmp = Float64(a / d);
	else
		tmp = Float64(b / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if ((d <= -5.8e+129) || ~((d <= 2.8e+183)))
		tmp = a / d;
	else
		tmp = b / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -5.8e+129], N[Not[LessEqual[d, 2.8e+183]], $MachinePrecision]], N[(a / d), $MachinePrecision], N[(b / c), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.8 \cdot 10^{+129} \lor \neg \left(d \leq 2.8 \cdot 10^{+183}\right):\\
\;\;\;\;\frac{a}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -5.80000000000000005e129 or 2.80000000000000018e183 < d

    1. Initial program 39.3%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt39.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-frac39.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-def39.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-def68.4%

        \[\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-rr68.4%

      \[\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)}} \]
    4. Taylor expanded in c around 0 60.5%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(-1 \cdot a\right)} \]
    5. Step-by-step derivation
      1. neg-mul-160.5%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(-a\right)} \]
    6. Simplified60.5%

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

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

    if -5.80000000000000005e129 < d < 2.80000000000000018e183

    1. Initial program 72.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5.8 \cdot 10^{+129} \lor \neg \left(d \leq 2.8 \cdot 10^{+183}\right):\\ \;\;\;\;\frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]

Alternative 14: 9.7% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \frac{a}{c} \end{array} \]
(FPCore (a b c d) :precision binary64 (/ a c))
double code(double a, double b, double c, double d) {
	return a / 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 = a / c
end function
public static double code(double a, double b, double c, double d) {
	return a / c;
}
def code(a, b, c, d):
	return a / c
function code(a, b, c, d)
	return Float64(a / c)
end
function tmp = code(a, b, c, d)
	tmp = a / c;
end
code[a_, b_, c_, d_] := N[(a / c), $MachinePrecision]
\begin{array}{l}

\\
\frac{a}{c}
\end{array}
Derivation
  1. Initial program 64.4%

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

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

      \[\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-frac64.4%

      \[\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-def64.4%

      \[\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-def78.8%

      \[\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-rr78.8%

    \[\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)}} \]
  4. Taylor expanded in c around 0 34.6%

    \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(-1 \cdot a\right)} \]
  5. Step-by-step derivation
    1. neg-mul-134.6%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(-a\right)} \]
  6. Simplified34.6%

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

    \[\leadsto \color{blue}{\frac{a}{c}} \]
  8. Final simplification7.2%

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

Alternative 15: 11.0% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \frac{a}{d} \end{array} \]
(FPCore (a b c d) :precision binary64 (/ a d))
double code(double a, double b, double c, double d) {
	return a / 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 = a / d
end function
public static double code(double a, double b, double c, double d) {
	return a / d;
}
def code(a, b, c, d):
	return a / d
function code(a, b, c, d)
	return Float64(a / d)
end
function tmp = code(a, b, c, d)
	tmp = a / d;
end
code[a_, b_, c_, d_] := N[(a / d), $MachinePrecision]
\begin{array}{l}

\\
\frac{a}{d}
\end{array}
Derivation
  1. Initial program 64.4%

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

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

      \[\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-frac64.4%

      \[\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-def64.4%

      \[\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-def78.8%

      \[\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-rr78.8%

    \[\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)}} \]
  4. Taylor expanded in c around 0 34.6%

    \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(-1 \cdot a\right)} \]
  5. Step-by-step derivation
    1. neg-mul-134.6%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(-a\right)} \]
  6. Simplified34.6%

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

    \[\leadsto \color{blue}{\frac{a}{d}} \]
  8. Final simplification11.8%

    \[\leadsto \frac{a}{d} \]

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 2023320 
(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))))