Complex division, imag part

Percentage Accurate: 61.1% → 97.8%
Time: 17.3s
Alternatives: 15
Speedup: 1.1×

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.1% 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: 97.8% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \frac{c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (-
  (/ (* c (/ b (hypot c d))) (hypot c d))
  (/ (* d (/ a (hypot c d))) (hypot c d))))
double code(double a, double b, double c, double d) {
	return ((c * (b / hypot(c, d))) / hypot(c, d)) - ((d * (a / hypot(c, d))) / hypot(c, d));
}
public static double code(double a, double b, double c, double d) {
	return ((c * (b / Math.hypot(c, d))) / Math.hypot(c, d)) - ((d * (a / Math.hypot(c, d))) / Math.hypot(c, d));
}
def code(a, b, c, d):
	return ((c * (b / math.hypot(c, d))) / math.hypot(c, d)) - ((d * (a / math.hypot(c, d))) / math.hypot(c, d))
function code(a, b, c, d)
	return Float64(Float64(Float64(c * Float64(b / hypot(c, d))) / hypot(c, d)) - Float64(Float64(d * Float64(a / hypot(c, d))) / hypot(c, d)))
end
function tmp = code(a, b, c, d)
	tmp = ((c * (b / hypot(c, d))) / hypot(c, d)) - ((d * (a / hypot(c, d))) / hypot(c, d));
end
code[a_, b_, c_, d_] := N[(N[(N[(c * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] - N[(N[(d * N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}
\end{array}
Derivation
  1. Initial program 63.0%

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

      \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
    2. add-sqr-sqrt63.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-frac63.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-def63.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-def77.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-rr77.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. Step-by-step derivation
    1. div-sub77.4%

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{b}{\mathsf{hypot}\left(c, d\right)} \cdot c - d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}\right)} \]
  8. Step-by-step derivation
    1. associate-*l/96.9%

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

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

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

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

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

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

Alternative 2: 97.5% accurate, 0.0× speedup?

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

\\
\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}\right)
\end{array}
Derivation
  1. Initial program 63.0%

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

      \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
    2. add-sqr-sqrt63.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-frac63.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-def63.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-def77.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-rr77.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. Step-by-step derivation
    1. div-sub77.4%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 85.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\ t_1 := t_0 \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;c \leq -2.15 \cdot 10^{+71}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -5.5 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{-227}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.68 \cdot 10^{+80}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - a \cdot \frac{d}{c}\right)\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ 1.0 (hypot c d)))
        (t_1 (* t_0 (/ (- (* c b) (* d a)) (hypot c d)))))
   (if (<= c -2.15e+71)
     (+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
     (if (<= c -5.5e-101)
       t_1
       (if (<= c 1.1e-227)
         (/ (- (* b (/ c d)) a) d)
         (if (<= c 1.68e+80)
           t_1
           (* t_0 (- (* c (/ b (hypot c d))) (* a (/ d c))))))))))
double code(double a, double b, double c, double d) {
	double t_0 = 1.0 / hypot(c, d);
	double t_1 = t_0 * (((c * b) - (d * a)) / hypot(c, d));
	double tmp;
	if (c <= -2.15e+71) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -5.5e-101) {
		tmp = t_1;
	} else if (c <= 1.1e-227) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 1.68e+80) {
		tmp = t_1;
	} else {
		tmp = t_0 * ((c * (b / hypot(c, d))) - (a * (d / c)));
	}
	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 = t_0 * (((c * b) - (d * a)) / Math.hypot(c, d));
	double tmp;
	if (c <= -2.15e+71) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -5.5e-101) {
		tmp = t_1;
	} else if (c <= 1.1e-227) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 1.68e+80) {
		tmp = t_1;
	} else {
		tmp = t_0 * ((c * (b / Math.hypot(c, d))) - (a * (d / c)));
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = 1.0 / math.hypot(c, d)
	t_1 = t_0 * (((c * b) - (d * a)) / math.hypot(c, d))
	tmp = 0
	if c <= -2.15e+71:
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))))
	elif c <= -5.5e-101:
		tmp = t_1
	elif c <= 1.1e-227:
		tmp = ((b * (c / d)) - a) / d
	elif c <= 1.68e+80:
		tmp = t_1
	else:
		tmp = t_0 * ((c * (b / math.hypot(c, d))) - (a * (d / c)))
	return tmp
function code(a, b, c, d)
	t_0 = Float64(1.0 / hypot(c, d))
	t_1 = Float64(t_0 * Float64(Float64(Float64(c * b) - Float64(d * a)) / hypot(c, d)))
	tmp = 0.0
	if (c <= -2.15e+71)
		tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c)))));
	elseif (c <= -5.5e-101)
		tmp = t_1;
	elseif (c <= 1.1e-227)
		tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d);
	elseif (c <= 1.68e+80)
		tmp = t_1;
	else
		tmp = Float64(t_0 * Float64(Float64(c * Float64(b / hypot(c, d))) - Float64(a * Float64(d / c))));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = 1.0 / hypot(c, d);
	t_1 = t_0 * (((c * b) - (d * a)) / hypot(c, d));
	tmp = 0.0;
	if (c <= -2.15e+71)
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	elseif (c <= -5.5e-101)
		tmp = t_1;
	elseif (c <= 1.1e-227)
		tmp = ((b * (c / d)) - a) / d;
	elseif (c <= 1.68e+80)
		tmp = t_1;
	else
		tmp = t_0 * ((c * (b / hypot(c, d))) - (a * (d / c)));
	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[(t$95$0 * N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.15e+71], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -5.5e-101], t$95$1, If[LessEqual[c, 1.1e-227], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.68e+80], t$95$1, N[(t$95$0 * N[(N[(c * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \leq -5.5 \cdot 10^{-101}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;c \leq 1.68 \cdot 10^{+80}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 40.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. clear-num82.3%

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

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

    if -2.14999999999999992e71 < c < -5.49999999999999973e-101 or 1.0999999999999999e-227 < c < 1.68000000000000006e80

    1. Initial program 85.8%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt85.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-frac85.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-def85.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-def95.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-rr95.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)}} \]

    if -5.49999999999999973e-101 < c < 1.0999999999999999e-227

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.68000000000000006e80 < c

    1. Initial program 36.4%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt36.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-frac36.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-def36.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-def58.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-rr58.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. Step-by-step derivation
      1. div-sub58.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.15 \cdot 10^{+71}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -5.5 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{-227}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.68 \cdot 10^{+80}:\\ \;\;\;\;\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 \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - a \cdot \frac{d}{c}\right)\\ \end{array} \]

Alternative 4: 84.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;c \leq -1.65 \cdot 10^{+69}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -5.6 \cdot 10^{-107}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{-227}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{+81}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (* (/ 1.0 (hypot c d)) (/ (- (* c b) (* d a)) (hypot c d)))))
   (if (<= c -1.65e+69)
     (+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
     (if (<= c -5.6e-107)
       t_0
       (if (<= c 1.05e-227)
         (/ (- (* b (/ c d)) a) d)
         (if (<= c 1.75e+81) t_0 (/ (- b (* a (/ d c))) (hypot c d))))))))
double code(double a, double b, double c, double d) {
	double t_0 = (1.0 / hypot(c, d)) * (((c * b) - (d * a)) / hypot(c, d));
	double tmp;
	if (c <= -1.65e+69) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -5.6e-107) {
		tmp = t_0;
	} else if (c <= 1.05e-227) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 1.75e+81) {
		tmp = t_0;
	} else {
		tmp = (b - (a * (d / c))) / hypot(c, d);
	}
	return tmp;
}
public static double code(double a, double b, double c, double d) {
	double t_0 = (1.0 / Math.hypot(c, d)) * (((c * b) - (d * a)) / Math.hypot(c, d));
	double tmp;
	if (c <= -1.65e+69) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -5.6e-107) {
		tmp = t_0;
	} else if (c <= 1.05e-227) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 1.75e+81) {
		tmp = t_0;
	} else {
		tmp = (b - (a * (d / c))) / Math.hypot(c, d);
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (1.0 / math.hypot(c, d)) * (((c * b) - (d * a)) / math.hypot(c, d))
	tmp = 0
	if c <= -1.65e+69:
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))))
	elif c <= -5.6e-107:
		tmp = t_0
	elif c <= 1.05e-227:
		tmp = ((b * (c / d)) - a) / d
	elif c <= 1.75e+81:
		tmp = t_0
	else:
		tmp = (b - (a * (d / c))) / math.hypot(c, d)
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(1.0 / hypot(c, d)) * Float64(Float64(Float64(c * b) - Float64(d * a)) / hypot(c, d)))
	tmp = 0.0
	if (c <= -1.65e+69)
		tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c)))));
	elseif (c <= -5.6e-107)
		tmp = t_0;
	elseif (c <= 1.05e-227)
		tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d);
	elseif (c <= 1.75e+81)
		tmp = t_0;
	else
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / hypot(c, d));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (1.0 / hypot(c, d)) * (((c * b) - (d * a)) / hypot(c, d));
	tmp = 0.0;
	if (c <= -1.65e+69)
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	elseif (c <= -5.6e-107)
		tmp = t_0;
	elseif (c <= 1.05e-227)
		tmp = ((b * (c / d)) - a) / d;
	elseif (c <= 1.75e+81)
		tmp = t_0;
	else
		tmp = (b - (a * (d / c))) / hypot(c, d);
	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[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.65e+69], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -5.6e-107], t$95$0, If[LessEqual[c, 1.05e-227], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.75e+81], t$95$0, N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \leq -5.6 \cdot 10^{-107}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 1.75 \cdot 10^{+81}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 40.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. clear-num82.3%

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

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

    if -1.6499999999999999e69 < c < -5.5999999999999998e-107 or 1.05e-227 < c < 1.75e81

    1. Initial program 85.8%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt85.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-frac85.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-def85.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-def95.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-rr95.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)}} \]

    if -5.5999999999999998e-107 < c < 1.05e-227

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.75e81 < c

    1. Initial program 36.4%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt36.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-frac36.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-def36.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-def58.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-rr58.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 89.9%

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

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

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(b - d \cdot \frac{a}{c}\right)} \]
    7. Step-by-step derivation
      1. associate-*l/92.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.65 \cdot 10^{+69}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -5.6 \cdot 10^{-107}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{-227}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{+81}:\\ \;\;\;\;\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{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]

Alternative 5: 82.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{if}\;c \leq -6.5 \cdot 10^{+56}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -3.8 \cdot 10^{-107}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 9 \cdot 10^{-161}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 4 \cdot 10^{+79}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \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)) (+ (* d d) (* c c)))))
   (if (<= c -6.5e+56)
     (+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
     (if (<= c -3.8e-107)
       t_0
       (if (<= c 9e-161)
         (/ (- (* b (/ c d)) a) d)
         (if (<= c 4e+79) t_0 (/ (- b (* a (/ d c))) (hypot c d))))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
	double tmp;
	if (c <= -6.5e+56) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -3.8e-107) {
		tmp = t_0;
	} else if (c <= 9e-161) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 4e+79) {
		tmp = t_0;
	} else {
		tmp = (b - (a * (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)) / ((d * d) + (c * c));
	double tmp;
	if (c <= -6.5e+56) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -3.8e-107) {
		tmp = t_0;
	} else if (c <= 9e-161) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 4e+79) {
		tmp = t_0;
	} else {
		tmp = (b - (a * (d / c))) / Math.hypot(c, d);
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c))
	tmp = 0
	if c <= -6.5e+56:
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))))
	elif c <= -3.8e-107:
		tmp = t_0
	elif c <= 9e-161:
		tmp = ((b * (c / d)) - a) / d
	elif c <= 4e+79:
		tmp = t_0
	else:
		tmp = (b - (a * (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(d * d) + Float64(c * c)))
	tmp = 0.0
	if (c <= -6.5e+56)
		tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c)))));
	elseif (c <= -3.8e-107)
		tmp = t_0;
	elseif (c <= 9e-161)
		tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d);
	elseif (c <= 4e+79)
		tmp = t_0;
	else
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / hypot(c, d));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
	tmp = 0.0;
	if (c <= -6.5e+56)
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	elseif (c <= -3.8e-107)
		tmp = t_0;
	elseif (c <= 9e-161)
		tmp = ((b * (c / d)) - a) / d;
	elseif (c <= 4e+79)
		tmp = t_0;
	else
		tmp = (b - (a * (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[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -6.5e+56], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.8e-107], t$95$0, If[LessEqual[c, 9e-161], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 4e+79], t$95$0, N[(N[(b - N[(a * 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}{d \cdot d + c \cdot c}\\
\mathbf{if}\;c \leq -6.5 \cdot 10^{+56}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\

\mathbf{elif}\;c \leq -3.8 \cdot 10^{-107}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 4 \cdot 10^{+79}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 43.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. clear-num83.3%

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

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

    if -6.5000000000000001e56 < c < -3.8000000000000002e-107 or 8.9999999999999993e-161 < c < 3.99999999999999987e79

    1. Initial program 87.5%

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

    if -3.8000000000000002e-107 < c < 8.9999999999999993e-161

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999987e79 < c

    1. Initial program 36.4%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt36.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-frac36.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-def36.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-def58.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-rr58.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 89.9%

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

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

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(b - d \cdot \frac{a}{c}\right)} \]
    7. Step-by-step derivation
      1. associate-*l/92.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -6.5 \cdot 10^{+56}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -3.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq 9 \cdot 10^{-161}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 4 \cdot 10^{+79}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]

Alternative 6: 82.1% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;c \leq -1.5 \cdot 10^{-108}:\\
\;\;\;\;\frac{t_0}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\

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

\mathbf{elif}\;c \leq 4.4 \cdot 10^{+80}:\\
\;\;\;\;\frac{t_0}{d \cdot d + c \cdot c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if c < -1.4500000000000001e57

    1. Initial program 43.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. clear-num83.3%

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

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

    if -1.4500000000000001e57 < c < -1.49999999999999996e-108

    1. Initial program 89.0%

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

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

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

    if -1.49999999999999996e-108 < c < 2.4499999999999999e-160

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4499999999999999e-160 < c < 4.40000000000000005e80

    1. Initial program 86.6%

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

    if 4.40000000000000005e80 < c

    1. Initial program 36.4%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt36.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-frac36.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-def36.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-def58.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-rr58.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 89.9%

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

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

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(b - d \cdot \frac{a}{c}\right)} \]
    7. Step-by-step derivation
      1. associate-*l/92.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.45 \cdot 10^{+57}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -1.5 \cdot 10^{-108}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{elif}\;c \leq 2.45 \cdot 10^{-160}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 4.4 \cdot 10^{+80}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\ \end{array} \]

Alternative 7: 81.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{if}\;c \leq -4.3 \cdot 10^{+57}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -3.3 \cdot 10^{-106}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2.2 \cdot 10^{-160}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.16 \cdot 10^{+77}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- (* c b) (* d a)) (+ (* d d) (* c c)))))
   (if (<= c -4.3e+57)
     (+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
     (if (<= c -3.3e-106)
       t_0
       (if (<= c 2.2e-160)
         (/ (- (* b (/ c d)) a) d)
         (if (<= c 1.16e+77) t_0 (/ (- b (* a (/ d c))) c)))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
	double tmp;
	if (c <= -4.3e+57) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -3.3e-106) {
		tmp = t_0;
	} else if (c <= 2.2e-160) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 1.16e+77) {
		tmp = t_0;
	} else {
		tmp = (b - (a * (d / c))) / 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) :: t_0
    real(8) :: tmp
    t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c))
    if (c <= (-4.3d+57)) then
        tmp = (b / c) + ((-1.0d0) / (c / (d * (a / c))))
    else if (c <= (-3.3d-106)) then
        tmp = t_0
    else if (c <= 2.2d-160) then
        tmp = ((b * (c / d)) - a) / d
    else if (c <= 1.16d+77) then
        tmp = t_0
    else
        tmp = (b - (a * (d / c))) / c
    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)) / ((d * d) + (c * c));
	double tmp;
	if (c <= -4.3e+57) {
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	} else if (c <= -3.3e-106) {
		tmp = t_0;
	} else if (c <= 2.2e-160) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (c <= 1.16e+77) {
		tmp = t_0;
	} else {
		tmp = (b - (a * (d / c))) / c;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c))
	tmp = 0
	if c <= -4.3e+57:
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))))
	elif c <= -3.3e-106:
		tmp = t_0
	elif c <= 2.2e-160:
		tmp = ((b * (c / d)) - a) / d
	elif c <= 1.16e+77:
		tmp = t_0
	else:
		tmp = (b - (a * (d / c))) / c
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(d * d) + Float64(c * c)))
	tmp = 0.0
	if (c <= -4.3e+57)
		tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c)))));
	elseif (c <= -3.3e-106)
		tmp = t_0;
	elseif (c <= 2.2e-160)
		tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d);
	elseif (c <= 1.16e+77)
		tmp = t_0;
	else
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
	tmp = 0.0;
	if (c <= -4.3e+57)
		tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
	elseif (c <= -3.3e-106)
		tmp = t_0;
	elseif (c <= 2.2e-160)
		tmp = ((b * (c / d)) - a) / d;
	elseif (c <= 1.16e+77)
		tmp = t_0;
	else
		tmp = (b - (a * (d / c))) / c;
	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[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -4.3e+57], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.3e-106], t$95$0, If[LessEqual[c, 2.2e-160], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.16e+77], t$95$0, N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c \leq -3.3 \cdot 10^{-106}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 1.16 \cdot 10^{+77}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 43.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a}{c} \cdot d}{c}} \]
      2. clear-num83.3%

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

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

    if -4.30000000000000033e57 < c < -3.30000000000000016e-106 or 2.2e-160 < c < 1.1600000000000001e77

    1. Initial program 87.5%

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

    if -3.30000000000000016e-106 < c < 2.2e-160

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1600000000000001e77 < c

    1. Initial program 36.4%

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. add-sqr-sqrt36.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-frac36.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-def36.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-def58.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-rr58.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 81.7%

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

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

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

        \[\leadsto \frac{b}{c} + \left(-1\right) \cdot \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      4. cancel-sign-sub-inv81.7%

        \[\leadsto \color{blue}{\frac{b}{c} - 1 \cdot \frac{a \cdot d}{c \cdot c}} \]
      5. *-lft-identity81.7%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot d}{c \cdot c}} \]
      6. associate-/r*90.0%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a \cdot d}{c}}{c}} \]
      7. associate-*r/92.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -4.3 \cdot 10^{+57}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq -3.3 \cdot 10^{-106}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq 2.2 \cdot 10^{-160}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.16 \cdot 10^{+77}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]

Alternative 8: 77.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -3.8e-31

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

    if -3.8e-31 < c < 1.59999999999999997e-11

    1. Initial program 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.59999999999999997e-11 < c

    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.5%

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

        \[\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-def65.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-rr65.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 inf 80.9%

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

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

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

        \[\leadsto \frac{b}{c} + \left(-1\right) \cdot \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      4. cancel-sign-sub-inv80.9%

        \[\leadsto \color{blue}{\frac{b}{c} - 1 \cdot \frac{a \cdot d}{c \cdot c}} \]
      5. *-lft-identity80.9%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot d}{c \cdot c}} \]
      6. associate-/r*87.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a \cdot d}{c}}{c}} \]
      7. associate-*r/89.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.8 \cdot 10^{-31}:\\ \;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-11}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]

Alternative 9: 67.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.1 \cdot 10^{-26} \lor \neg \left(c \leq 8.5 \cdot 10^{-151}\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\

\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -4.0999999999999999e-26 or 8.49999999999999999e-151 < c

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{c} + \left(-1\right) \cdot \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      4. cancel-sign-sub-inv71.4%

        \[\leadsto \color{blue}{\frac{b}{c} - 1 \cdot \frac{a \cdot d}{c \cdot c}} \]
      5. *-lft-identity71.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot d}{c \cdot c}} \]
      6. associate-/r*75.2%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a \cdot d}{c}}{c}} \]
      7. associate-*r/77.2%

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

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

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

    if -4.0999999999999999e-26 < c < 8.49999999999999999e-151

    1. Initial program 70.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -4.1 \cdot 10^{-26} \lor \neg \left(c \leq 8.5 \cdot 10^{-151}\right):\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]

Alternative 10: 67.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.75 \cdot 10^{-32}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -3.74999999999999977e-32

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

    if -3.74999999999999977e-32 < c < 8.49999999999999999e-151

    1. Initial program 70.9%

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

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

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

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

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

    if 8.49999999999999999e-151 < c

    1. Initial program 60.9%

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

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

        \[\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-def60.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-def75.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-rr75.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 69.4%

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

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

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

        \[\leadsto \frac{b}{c} + \left(-1\right) \cdot \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      4. cancel-sign-sub-inv69.4%

        \[\leadsto \color{blue}{\frac{b}{c} - 1 \cdot \frac{a \cdot d}{c \cdot c}} \]
      5. *-lft-identity69.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot d}{c \cdot c}} \]
      6. associate-/r*73.7%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a \cdot d}{c}}{c}} \]
      7. associate-*r/74.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.75 \cdot 10^{-32}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 8.5 \cdot 10^{-151}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]

Alternative 11: 76.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.1 \cdot 10^{-29}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -2.09999999999999989e-29

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.09999999999999989e-29 < c < 1.42e-11

    1. Initial program 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c \cdot \frac{b}{d}}{d}} - \frac{a}{d} \]
      8. div-sub79.9%

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

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

    if 1.42e-11 < c

    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.5%

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

        \[\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-def65.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-rr65.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 inf 80.9%

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

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

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

        \[\leadsto \frac{b}{c} + \left(-1\right) \cdot \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      4. cancel-sign-sub-inv80.9%

        \[\leadsto \color{blue}{\frac{b}{c} - 1 \cdot \frac{a \cdot d}{c \cdot c}} \]
      5. *-lft-identity80.9%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot d}{c \cdot c}} \]
      6. associate-/r*87.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a \cdot d}{c}}{c}} \]
      7. associate-*r/89.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.1 \cdot 10^{-29}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 1.42 \cdot 10^{-11}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]

Alternative 12: 77.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -8.2 \cdot 10^{-32}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -8.1999999999999995e-32

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

    if -8.1999999999999995e-32 < c < 1.18e-11

    1. Initial program 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.18e-11 < c

    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.5%

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

        \[\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-def65.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-rr65.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 inf 80.9%

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

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

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

        \[\leadsto \frac{b}{c} + \left(-1\right) \cdot \frac{a \cdot d}{\color{blue}{c \cdot c}} \]
      4. cancel-sign-sub-inv80.9%

        \[\leadsto \color{blue}{\frac{b}{c} - 1 \cdot \frac{a \cdot d}{c \cdot c}} \]
      5. *-lft-identity80.9%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{a \cdot d}{c \cdot c}} \]
      6. associate-/r*87.4%

        \[\leadsto \frac{b}{c} - \color{blue}{\frac{\frac{a \cdot d}{c}}{c}} \]
      7. associate-*r/89.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -8.2 \cdot 10^{-32}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq 1.18 \cdot 10^{-11}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \end{array} \]

Alternative 13: 60.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.2 \cdot 10^{-26}:\\
\;\;\;\;\frac{b}{c}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.2e-26 or 8.2000000000000002e-151 < c

    1. Initial program 58.0%

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

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

    if -1.2e-26 < c < 8.2000000000000002e-151

    1. Initial program 70.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.2 \cdot 10^{-26}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 8.2 \cdot 10^{-151}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]

Alternative 14: 9.5% 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 63.0%

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

      \[\leadsto \frac{\color{blue}{1 \cdot \left(b \cdot c - a \cdot d\right)}}{c \cdot c + d \cdot d} \]
    2. add-sqr-sqrt63.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-frac63.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-def63.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-def77.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-rr77.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 inf 37.4%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{a}{c}} \]
  8. Final simplification9.9%

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

Alternative 15: 42.7% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{b}{c}} \]
  3. Final simplification45.5%

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

Developer target: 99.3% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left|d\right| < \left|c\right|:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\

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


\end{array}
\end{array}

Reproduce

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