ABCF->ab-angle b

Percentage Accurate: 18.8% → 51.9%
Time: 23.0s
Alternatives: 14
Speedup: 5.8×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\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 14 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: 18.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}

Alternative 1: 51.9% accurate, 0.3× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \frac{A \cdot \left(4 \cdot C\right) - B\_m \cdot B\_m}{A \cdot \sqrt{F \cdot \left(C \cdot -16 + 4 \cdot \frac{B\_m \cdot B\_m}{A}\right)}}\\ t_1 := \left(A \cdot C\right) \cdot -4\\ t_2 := B\_m \cdot B\_m + t\_1\\ t_3 := \left(4 \cdot A\right) \cdot C\\ t_4 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_3\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3 - {B\_m}^{2}}\\ \mathbf{if}\;t\_4 \leq -5 \cdot 10^{-208}:\\ \;\;\;\;\frac{\sqrt{t\_2}}{\left(0 - B\_m \cdot B\_m\right) - t\_1} \cdot \sqrt{\left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}\\ \mathbf{elif}\;t\_4 \leq 10^{+215}:\\ \;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0
         (/
          (- (* A (* 4.0 C)) (* B_m B_m))
          (* A (sqrt (* F (+ (* C -16.0) (* 4.0 (/ (* B_m B_m) A))))))))
        (t_1 (* (* A C) -4.0))
        (t_2 (+ (* B_m B_m) t_1))
        (t_3 (* (* 4.0 A) C))
        (t_4
         (/
          (sqrt
           (*
            (* 2.0 (* (- (pow B_m 2.0) t_3) F))
            (- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
          (- t_3 (pow B_m 2.0)))))
   (if (<= t_4 -5e-208)
     (*
      (/ (sqrt t_2) (- (- 0.0 (* B_m B_m)) t_1))
      (sqrt (* (+ A (- C (hypot B_m (- A C)))) (* 2.0 F))))
     (if (<= t_4 1e+215)
       (/
        (sqrt (* t_2 (* (* 2.0 F) (+ A (+ A (* -0.5 (/ (* B_m B_m) C)))))))
        (- (* 4.0 (* A C)) (* B_m B_m)))
       (if (<= t_4 INFINITY)
         (pow (* t_0 t_0) -0.5)
         (/ (pow (* 2.0 (* F (- A (hypot B_m A)))) 0.5) (- 0.0 B_m)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A))))));
	double t_1 = (A * C) * -4.0;
	double t_2 = (B_m * B_m) + t_1;
	double t_3 = (4.0 * A) * C;
	double t_4 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_3) * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_3 - pow(B_m, 2.0));
	double tmp;
	if (t_4 <= -5e-208) {
		tmp = (sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * sqrt(((A + (C - hypot(B_m, (A - C)))) * (2.0 * F)));
	} else if (t_4 <= 1e+215) {
		tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = pow((t_0 * t_0), -0.5);
	} else {
		tmp = pow((2.0 * (F * (A - hypot(B_m, A)))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * Math.sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A))))));
	double t_1 = (A * C) * -4.0;
	double t_2 = (B_m * B_m) + t_1;
	double t_3 = (4.0 * A) * C;
	double t_4 = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_3) * F)) * ((A + C) - Math.sqrt((Math.pow(B_m, 2.0) + Math.pow((A - C), 2.0)))))) / (t_3 - Math.pow(B_m, 2.0));
	double tmp;
	if (t_4 <= -5e-208) {
		tmp = (Math.sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * Math.sqrt(((A + (C - Math.hypot(B_m, (A - C)))) * (2.0 * F)));
	} else if (t_4 <= 1e+215) {
		tmp = Math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else if (t_4 <= Double.POSITIVE_INFINITY) {
		tmp = Math.pow((t_0 * t_0), -0.5);
	} else {
		tmp = Math.pow((2.0 * (F * (A - Math.hypot(B_m, A)))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * math.sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A))))))
	t_1 = (A * C) * -4.0
	t_2 = (B_m * B_m) + t_1
	t_3 = (4.0 * A) * C
	t_4 = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_3) * F)) * ((A + C) - math.sqrt((math.pow(B_m, 2.0) + math.pow((A - C), 2.0)))))) / (t_3 - math.pow(B_m, 2.0))
	tmp = 0
	if t_4 <= -5e-208:
		tmp = (math.sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * math.sqrt(((A + (C - math.hypot(B_m, (A - C)))) * (2.0 * F)))
	elif t_4 <= 1e+215:
		tmp = math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m))
	elif t_4 <= math.inf:
		tmp = math.pow((t_0 * t_0), -0.5)
	else:
		tmp = math.pow((2.0 * (F * (A - math.hypot(B_m, A)))), 0.5) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(Float64(Float64(A * Float64(4.0 * C)) - Float64(B_m * B_m)) / Float64(A * sqrt(Float64(F * Float64(Float64(C * -16.0) + Float64(4.0 * Float64(Float64(B_m * B_m) / A)))))))
	t_1 = Float64(Float64(A * C) * -4.0)
	t_2 = Float64(Float64(B_m * B_m) + t_1)
	t_3 = Float64(Float64(4.0 * A) * C)
	t_4 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_3) * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_3 - (B_m ^ 2.0)))
	tmp = 0.0
	if (t_4 <= -5e-208)
		tmp = Float64(Float64(sqrt(t_2) / Float64(Float64(0.0 - Float64(B_m * B_m)) - t_1)) * sqrt(Float64(Float64(A + Float64(C - hypot(B_m, Float64(A - C)))) * Float64(2.0 * F))));
	elseif (t_4 <= 1e+215)
		tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(2.0 * F) * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(B_m * B_m) / C))))))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m)));
	elseif (t_4 <= Inf)
		tmp = Float64(t_0 * t_0) ^ -0.5;
	else
		tmp = Float64((Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A)))) ^ 0.5) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A))))));
	t_1 = (A * C) * -4.0;
	t_2 = (B_m * B_m) + t_1;
	t_3 = (4.0 * A) * C;
	t_4 = sqrt(((2.0 * (((B_m ^ 2.0) - t_3) * F)) * ((A + C) - sqrt(((B_m ^ 2.0) + ((A - C) ^ 2.0)))))) / (t_3 - (B_m ^ 2.0));
	tmp = 0.0;
	if (t_4 <= -5e-208)
		tmp = (sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * sqrt(((A + (C - hypot(B_m, (A - C)))) * (2.0 * F)));
	elseif (t_4 <= 1e+215)
		tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m));
	elseif (t_4 <= Inf)
		tmp = (t_0 * t_0) ^ -0.5;
	else
		tmp = ((2.0 * (F * (A - hypot(B_m, A)))) ^ 0.5) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(N[(A * N[(4.0 * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision] / N[(A * N[Sqrt[N[(F * N[(N[(C * -16.0), $MachinePrecision] + N[(4.0 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B$95$m * B$95$m), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$3), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$3 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-208], N[(N[(N[Sqrt[t$95$2], $MachinePrecision] / N[(N[(0.0 - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e+215], N[(N[Sqrt[N[(t$95$2 * N[(N[(2.0 * F), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], -0.5], $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{A \cdot \left(4 \cdot C\right) - B\_m \cdot B\_m}{A \cdot \sqrt{F \cdot \left(C \cdot -16 + 4 \cdot \frac{B\_m \cdot B\_m}{A}\right)}}\\
t_1 := \left(A \cdot C\right) \cdot -4\\
t_2 := B\_m \cdot B\_m + t\_1\\
t_3 := \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_3\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3 - {B\_m}^{2}}\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-208}:\\
\;\;\;\;\frac{\sqrt{t\_2}}{\left(0 - B\_m \cdot B\_m\right) - t\_1} \cdot \sqrt{\left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}\\

\mathbf{elif}\;t\_4 \leq 10^{+215}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -4.99999999999999963e-208

    1. Initial program 41.4%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Applied egg-rr65.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{-1} \cdot \frac{\sqrt{B \cdot B + \left(A \cdot C\right) \cdot -4}}{B \cdot B + \left(A \cdot C\right) \cdot -4}} \]

    if -4.99999999999999963e-208 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < 9.99999999999999907e214

    1. Initial program 27.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified27.2%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\color{blue}{\left(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}, \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} - -1 \cdot A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} + \left(\mathsf{neg}\left(-1\right)\right) \cdot A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} + 1 \cdot A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} + A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{{B}^{2}}{C}\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\left({B}^{2}\right), C\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\left(B \cdot B\right), C\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      11. *-lowering-*.f6431.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{*.f64}\left(B, B\right), C\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified31.2%

      \[\leadsto \frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\color{blue}{\left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)} \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 9.99999999999999907e214 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0

    1. Initial program 3.6%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified29.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in A around -inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\left({A}^{2} \cdot \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)}\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left({A}^{2}\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{4}, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(A \cdot A\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\left(-16 \cdot \left(C \cdot F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \left(C \cdot F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \left(\frac{4 \cdot \left({B}^{2} \cdot F\right)}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\left(4 \cdot \left({B}^{2} \cdot F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left({B}^{2} \cdot F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\left({B}^{2}\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\left(B \cdot B\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      12. *-lowering-*.f643.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified3.8%

      \[\leadsto \frac{\sqrt{\color{blue}{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]
    8. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}}} \]
      2. metadata-evalN/A

        \[\leadsto \frac{-1 \cdot -1}{\frac{\color{blue}{4 \cdot \left(A \cdot C\right) - B \cdot B}}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot -1\right), \color{blue}{\left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}\right)}\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\color{blue}{4 \cdot \left(A \cdot C\right) - B \cdot B}}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}\right)\right) \]
      5. pow1/2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)\right)}^{\color{blue}{\frac{1}{2}}}}\right)\right) \]
      6. unpow-prod-downN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(A \cdot A\right)}^{\frac{1}{2}} \cdot \color{blue}{{\left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}^{\frac{1}{2}}}}\right)\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(A \cdot A\right)}^{\frac{1}{2}}}}{\color{blue}{{\left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}^{\frac{1}{2}}}}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(A \cdot A\right)}^{\frac{1}{2}}}\right), \color{blue}{\left({\left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}^{\frac{1}{2}}\right)}\right)\right) \]
    9. Applied egg-rr1.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}}} \]
    10. Step-by-step derivation
      1. inv-powN/A

        \[\leadsto {\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right)}^{\color{blue}{-1}} \]
      2. metadata-evalN/A

        \[\leadsto {\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right)}^{\left(\frac{-1}{2} + \color{blue}{\frac{-1}{2}}\right)} \]
      3. metadata-evalN/A

        \[\leadsto {\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right)}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \frac{-1}{2}\right)} \]
      4. metadata-evalN/A

        \[\leadsto {\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right)}^{\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} \]
      5. pow-prod-upN/A

        \[\leadsto {\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot \color{blue}{{\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
      6. pow-prod-downN/A

        \[\leadsto {\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}} \cdot \frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
      7. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\left(\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}} \cdot \frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}\right), \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right) \]
    11. Applied egg-rr56.6%

      \[\leadsto \color{blue}{{\left(\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A \cdot \sqrt{F \cdot \left(C \cdot -16 + 4 \cdot \frac{B \cdot B}{A}\right)}} \cdot \frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A \cdot \sqrt{F \cdot \left(C \cdot -16 + 4 \cdot \frac{B \cdot B}{A}\right)}}\right)}^{-0.5}} \]

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)))

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6422.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified22.4%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr22.5%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification40.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}} \leq -5 \cdot 10^{-208}:\\ \;\;\;\;\frac{\sqrt{B \cdot B + \left(A \cdot C\right) \cdot -4}}{\left(0 - B \cdot B\right) - \left(A \cdot C\right) \cdot -4} \cdot \sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}\\ \mathbf{elif}\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}} \leq 10^{+215}:\\ \;\;\;\;\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{elif}\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}} \leq \infty:\\ \;\;\;\;{\left(\frac{A \cdot \left(4 \cdot C\right) - B \cdot B}{A \cdot \sqrt{F \cdot \left(C \cdot -16 + 4 \cdot \frac{B \cdot B}{A}\right)}} \cdot \frac{A \cdot \left(4 \cdot C\right) - B \cdot B}{A \cdot \sqrt{F \cdot \left(C \cdot -16 + 4 \cdot \frac{B \cdot B}{A}\right)}}\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 46.9% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := 4 \cdot \left(A \cdot C\right)\\ t_1 := t\_0 - B\_m \cdot B\_m\\ t_2 := B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\\ \mathbf{if}\;B\_m \leq 3.4 \cdot 10^{-90}:\\ \;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{t\_1}\\ \mathbf{elif}\;B\_m \leq 1300000000000:\\ \;\;\;\;\sqrt{\frac{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}{B\_m \cdot B\_m - t\_0}} \cdot \left(0 - \sqrt{2}\right)\\ \mathbf{elif}\;B\_m \leq 1.25 \cdot 10^{+37}:\\ \;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right)\right)\right)}}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* 4.0 (* A C)))
        (t_1 (- t_0 (* B_m B_m)))
        (t_2 (+ (* B_m B_m) (* (* A C) -4.0))))
   (if (<= B_m 3.4e-90)
     (/ (sqrt (* t_2 (* (* 2.0 F) (+ A A)))) t_1)
     (if (<= B_m 1300000000000.0)
       (*
        (sqrt (/ (* F (+ A (- C (hypot B_m (- A C))))) (- (* B_m B_m) t_0)))
        (- 0.0 (sqrt 2.0)))
       (if (<= B_m 1.25e+37)
         (/
          (sqrt (* t_2 (* (* 2.0 F) (+ A (+ A (* -0.5 (/ (* B_m B_m) C)))))))
          t_1)
         (/ (pow (* 2.0 (* F (- A (hypot B_m A)))) 0.5) (- 0.0 B_m)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = 4.0 * (A * C);
	double t_1 = t_0 - (B_m * B_m);
	double t_2 = (B_m * B_m) + ((A * C) * -4.0);
	double tmp;
	if (B_m <= 3.4e-90) {
		tmp = sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1;
	} else if (B_m <= 1300000000000.0) {
		tmp = sqrt(((F * (A + (C - hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - sqrt(2.0));
	} else if (B_m <= 1.25e+37) {
		tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1;
	} else {
		tmp = pow((2.0 * (F * (A - hypot(B_m, A)))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double t_0 = 4.0 * (A * C);
	double t_1 = t_0 - (B_m * B_m);
	double t_2 = (B_m * B_m) + ((A * C) * -4.0);
	double tmp;
	if (B_m <= 3.4e-90) {
		tmp = Math.sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1;
	} else if (B_m <= 1300000000000.0) {
		tmp = Math.sqrt(((F * (A + (C - Math.hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - Math.sqrt(2.0));
	} else if (B_m <= 1.25e+37) {
		tmp = Math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1;
	} else {
		tmp = Math.pow((2.0 * (F * (A - Math.hypot(B_m, A)))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	t_0 = 4.0 * (A * C)
	t_1 = t_0 - (B_m * B_m)
	t_2 = (B_m * B_m) + ((A * C) * -4.0)
	tmp = 0
	if B_m <= 3.4e-90:
		tmp = math.sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1
	elif B_m <= 1300000000000.0:
		tmp = math.sqrt(((F * (A + (C - math.hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - math.sqrt(2.0))
	elif B_m <= 1.25e+37:
		tmp = math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1
	else:
		tmp = math.pow((2.0 * (F * (A - math.hypot(B_m, A)))), 0.5) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(4.0 * Float64(A * C))
	t_1 = Float64(t_0 - Float64(B_m * B_m))
	t_2 = Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0))
	tmp = 0.0
	if (B_m <= 3.4e-90)
		tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(2.0 * F) * Float64(A + A)))) / t_1);
	elseif (B_m <= 1300000000000.0)
		tmp = Float64(sqrt(Float64(Float64(F * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))) / Float64(Float64(B_m * B_m) - t_0))) * Float64(0.0 - sqrt(2.0)));
	elseif (B_m <= 1.25e+37)
		tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(2.0 * F) * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(B_m * B_m) / C))))))) / t_1);
	else
		tmp = Float64((Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A)))) ^ 0.5) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	t_0 = 4.0 * (A * C);
	t_1 = t_0 - (B_m * B_m);
	t_2 = (B_m * B_m) + ((A * C) * -4.0);
	tmp = 0.0;
	if (B_m <= 3.4e-90)
		tmp = sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1;
	elseif (B_m <= 1300000000000.0)
		tmp = sqrt(((F * (A + (C - hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - sqrt(2.0));
	elseif (B_m <= 1.25e+37)
		tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1;
	else
		tmp = ((2.0 * (F * (A - hypot(B_m, A)))) ^ 0.5) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.4e-90], N[(N[Sqrt[N[(t$95$2 * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 1300000000000.0], N[(N[Sqrt[N[(N[(F * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(B$95$m * B$95$m), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.25e+37], N[(N[Sqrt[N[(t$95$2 * N[(N[(2.0 * F), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := t\_0 - B\_m \cdot B\_m\\
t_2 := B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\\
\mathbf{if}\;B\_m \leq 3.4 \cdot 10^{-90}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{t\_1}\\

\mathbf{elif}\;B\_m \leq 1300000000000:\\
\;\;\;\;\sqrt{\frac{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}{B\_m \cdot B\_m - t\_0}} \cdot \left(0 - \sqrt{2}\right)\\

\mathbf{elif}\;B\_m \leq 1.25 \cdot 10^{+37}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right)\right)\right)}}{t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 3.39999999999999994e-90

    1. Initial program 21.8%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified26.9%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\color{blue}{\left(A - -1 \cdot A\right)}, \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(-1 \cdot A\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(A\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. remove-double-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. +-lowering-+.f6417.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified17.7%

      \[\leadsto \frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\color{blue}{\left(A + A\right)} \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 3.39999999999999994e-90 < B < 1.3e12

    1. Initial program 32.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right) \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{2}\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}}\right), \color{blue}{\left(\mathsf{neg}\left(\sqrt{2}\right)\right)}\right) \]
    5. Simplified59.0%

      \[\leadsto \color{blue}{\sqrt{\frac{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}} \cdot \left(-\sqrt{2}\right)} \]

    if 1.3e12 < B < 1.24999999999999997e37

    1. Initial program 2.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified35.5%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\color{blue}{\left(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}, \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} - -1 \cdot A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} + \left(\mathsf{neg}\left(-1\right)\right) \cdot A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} + 1 \cdot A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} + A\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \left(\frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{{B}^{2}}{C}\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\left({B}^{2}\right), C\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\left(B \cdot B\right), C\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      11. *-lowering-*.f6438.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, \mathsf{+.f64}\left(A, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{*.f64}\left(B, B\right), C\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified38.2%

      \[\leadsto \frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\color{blue}{\left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)} \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 1.24999999999999997e37 < B

    1. Initial program 8.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6449.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified49.3%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr49.5%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification29.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 3.4 \cdot 10^{-90}:\\ \;\;\;\;\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{elif}\;B \leq 1300000000000:\\ \;\;\;\;\sqrt{\frac{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}} \cdot \left(0 - \sqrt{2}\right)\\ \mathbf{elif}\;B \leq 1.25 \cdot 10^{+37}:\\ \;\;\;\;\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 47.9% accurate, 2.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 1.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 1.4e-34)
   (/
    (sqrt (* (+ (* B_m B_m) (* (* A C) -4.0)) (* (* 2.0 F) (+ A A))))
    (- (* 4.0 (* A C)) (* B_m B_m)))
   (/ (pow (* 2.0 (* F (- A (hypot B_m A)))) 0.5) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.4e-34) {
		tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = pow((2.0 * (F * (A - hypot(B_m, A)))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.4e-34) {
		tmp = Math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = Math.pow((2.0 * (F * (A - Math.hypot(B_m, A)))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 1.4e-34:
		tmp = math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m))
	else:
		tmp = math.pow((2.0 * (F * (A - math.hypot(B_m, A)))), 0.5) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.4e-34)
		tmp = Float64(sqrt(Float64(Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0)) * Float64(Float64(2.0 * F) * Float64(A + A)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m)));
	else
		tmp = Float64((Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A)))) ^ 0.5) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 1.4e-34)
		tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	else
		tmp = ((2.0 * (F * (A - hypot(B_m, A)))) ^ 0.5) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.4e-34], N[(N[Sqrt[N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.4 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.39999999999999998e-34

    1. Initial program 21.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified26.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\color{blue}{\left(A - -1 \cdot A\right)}, \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(-1 \cdot A\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(A\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. remove-double-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. +-lowering-+.f6417.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified17.2%

      \[\leadsto \frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\color{blue}{\left(A + A\right)} \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 1.39999999999999998e-34 < B

    1. Initial program 14.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6449.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified49.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr50.0%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 47.9% accurate, 2.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 1.7 \cdot 10^{-34}:\\ \;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 1.7e-34)
   (/
    (sqrt (* (+ (* B_m B_m) (* (* A C) -4.0)) (* (* 2.0 F) (+ A A))))
    (- (* 4.0 (* A C)) (* B_m B_m)))
   (/ (sqrt (* (* 2.0 F) (- A (hypot A B_m)))) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.7e-34) {
		tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = sqrt(((2.0 * F) * (A - hypot(A, B_m)))) / (0.0 - B_m);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.7e-34) {
		tmp = Math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = Math.sqrt(((2.0 * F) * (A - Math.hypot(A, B_m)))) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 1.7e-34:
		tmp = math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m))
	else:
		tmp = math.sqrt(((2.0 * F) * (A - math.hypot(A, B_m)))) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.7e-34)
		tmp = Float64(sqrt(Float64(Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0)) * Float64(Float64(2.0 * F) * Float64(A + A)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m)));
	else
		tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - hypot(A, B_m)))) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 1.7e-34)
		tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	else
		tmp = sqrt(((2.0 * F) * (A - hypot(A, B_m)))) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.7e-34], N[(N[Sqrt[N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.7 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.7e-34

    1. Initial program 21.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified26.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\color{blue}{\left(A - -1 \cdot A\right)}, \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(-1 \cdot A\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(A\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. remove-double-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. +-lowering-+.f6417.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified17.2%

      \[\leadsto \frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\color{blue}{\left(A + A\right)} \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 1.7e-34 < B

    1. Initial program 14.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6449.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified49.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr50.0%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
    8. Step-by-step derivation
      1. unpow1/2N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2 \cdot \left(F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)}\right), B\right)\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(2 \cdot \left(F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right), B\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(2 \cdot F\right) \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)\right), B\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(A - \sqrt{B \cdot B + A \cdot A}\right) \cdot \left(2 \cdot F\right)\right)\right), B\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(A - \sqrt{B \cdot B + A \cdot A}\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \left(\sqrt{A \cdot A + B \cdot B}\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
      8. accelerator-lowering-hypot.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(A, B\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
      9. *-lowering-*.f6450.0%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(A, B\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right), B\right)\right) \]
    9. Applied egg-rr50.0%

      \[\leadsto -\frac{\color{blue}{\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(2 \cdot F\right)}}}{B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.7 \cdot 10^{-34}:\\ \;\;\;\;\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 43.8% accurate, 4.8× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 1.5 \cdot 10^{-34}:\\ \;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 1.5e-34)
   (/
    (sqrt (* (+ (* B_m B_m) (* (* A C) -4.0)) (* (* 2.0 F) (+ A A))))
    (- (* 4.0 (* A C)) (* B_m B_m)))
   (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.5e-34) {
		tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 1.5d-34) then
        tmp = sqrt((((b_m * b_m) + ((a * c) * (-4.0d0))) * ((2.0d0 * f) * (a + a)))) / ((4.0d0 * (a * c)) - (b_m * b_m))
    else
        tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.5e-34) {
		tmp = Math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 1.5e-34:
		tmp = math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m))
	else:
		tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.5e-34)
		tmp = Float64(sqrt(Float64(Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0)) * Float64(Float64(2.0 * F) * Float64(A + A)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m)));
	else
		tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 1.5e-34)
		tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
	else
		tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.5e-34], N[(N[Sqrt[N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.5 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.5e-34

    1. Initial program 21.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified26.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\color{blue}{\left(A - -1 \cdot A\right)}, \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(-1 \cdot A\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(A\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. remove-double-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\left(A + A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. +-lowering-+.f6417.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(B, B\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(A, C\right), -4\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(A, A\right), \mathsf{*.f64}\left(2, F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified17.2%

      \[\leadsto \frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\color{blue}{\left(A + A\right)} \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 1.5e-34 < B

    1. Initial program 14.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6449.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified49.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr50.0%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
    8. Taylor expanded in A around 0

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \color{blue}{\left(A - B\right)}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    9. Step-by-step derivation
      1. --lowering--.f6447.5%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, B\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    10. Simplified47.5%

      \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \color{blue}{\left(A - B\right)}\right)\right)}^{0.5}}{B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.5 \cdot 10^{-34}:\\ \;\;\;\;\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\right)\right)\right)}^{0.5}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 39.5% accurate, 5.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 7.2 \cdot 10^{-35}:\\ \;\;\;\;\frac{\sqrt{\left(A \cdot -8\right) \cdot \left(\left(A + A\right) \cdot \left(C \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 7.2e-35)
   (/
    (sqrt (* (* A -8.0) (* (+ A A) (* C F))))
    (- (* 4.0 (* A C)) (* B_m B_m)))
   (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 7.2e-35) {
		tmp = sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 7.2d-35) then
        tmp = sqrt(((a * (-8.0d0)) * ((a + a) * (c * f)))) / ((4.0d0 * (a * c)) - (b_m * b_m))
    else
        tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 7.2e-35) {
		tmp = Math.sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 7.2e-35:
		tmp = math.sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m))
	else:
		tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 7.2e-35)
		tmp = Float64(sqrt(Float64(Float64(A * -8.0) * Float64(Float64(A + A) * Float64(C * F)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m)));
	else
		tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 7.2e-35)
		tmp = sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m));
	else
		tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 7.2e-35], N[(N[Sqrt[N[(N[(A * -8.0), $MachinePrecision] * N[(N[(A + A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 7.2 \cdot 10^{-35}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -8\right) \cdot \left(\left(A + A\right) \cdot \left(C \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 7.20000000000000038e-35

    1. Initial program 21.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified26.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\left(-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)\right)}\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(-8 \cdot A\right) \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{4}, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(-8 \cdot A\right), \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{4}, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \left(\left(C \cdot F\right) \cdot \left(A - -1 \cdot A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \mathsf{*.f64}\left(\left(C \cdot F\right), \left(A - -1 \cdot A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(C, F\right), \left(A - -1 \cdot A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(C, F\right), \left(A + \left(\mathsf{neg}\left(-1 \cdot A\right)\right)\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(C, F\right), \left(A + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(A\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(C, F\right), \left(A + A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      10. +-lowering-+.f6414.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(-8, A\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(C, F\right), \mathsf{+.f64}\left(A, A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified14.8%

      \[\leadsto \frac{\sqrt{\color{blue}{\left(-8 \cdot A\right) \cdot \left(\left(C \cdot F\right) \cdot \left(A + A\right)\right)}}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 7.20000000000000038e-35 < B

    1. Initial program 14.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6449.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified49.8%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr50.0%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
    8. Taylor expanded in A around 0

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \color{blue}{\left(A - B\right)}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    9. Step-by-step derivation
      1. --lowering--.f6447.5%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, B\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    10. Simplified47.5%

      \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \color{blue}{\left(A - B\right)}\right)\right)}^{0.5}}{B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification24.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7.2 \cdot 10^{-35}:\\ \;\;\;\;\frac{\sqrt{\left(A \cdot -8\right) \cdot \left(\left(A + A\right) \cdot \left(C \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\right)\right)\right)}^{0.5}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 36.0% accurate, 5.1× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 5 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{-16 \cdot \left(F \cdot \left(C \cdot \left(A \cdot A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 5e-108)
   (/ (sqrt (* -16.0 (* F (* C (* A A))))) (- (* 4.0 (* A C)) (* B_m B_m)))
   (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 5e-108) {
		tmp = sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 5d-108) then
        tmp = sqrt(((-16.0d0) * (f * (c * (a * a))))) / ((4.0d0 * (a * c)) - (b_m * b_m))
    else
        tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 5e-108) {
		tmp = Math.sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m));
	} else {
		tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 5e-108:
		tmp = math.sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m))
	else:
		tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 5e-108)
		tmp = Float64(sqrt(Float64(-16.0 * Float64(F * Float64(C * Float64(A * A))))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m)));
	else
		tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 5e-108)
		tmp = sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m));
	else
		tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 5e-108], N[(N[Sqrt[N[(-16.0 * N[(F * N[(C * N[(A * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(F \cdot \left(C \cdot \left(A \cdot A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 5e-108

    1. Initial program 20.9%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified26.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in A around -inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\left(-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)\right)}\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \left({A}^{2} \cdot \left(C \cdot F\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{4}, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \left(\left({A}^{2} \cdot C\right) \cdot F\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(\left({A}^{2} \cdot C\right), F\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left({A}^{2}\right), C\right), F\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(A \cdot A\right), C\right), F\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      6. *-lowering-*.f6413.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), C\right), F\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified13.1%

      \[\leadsto \frac{\sqrt{\color{blue}{-16 \cdot \left(\left(\left(A \cdot A\right) \cdot C\right) \cdot F\right)}}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]

    if 5e-108 < B

    1. Initial program 15.6%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6446.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified46.9%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr47.1%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
    8. Taylor expanded in A around 0

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \color{blue}{\left(A - B\right)}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    9. Step-by-step derivation
      1. --lowering--.f6443.1%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, B\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    10. Simplified43.1%

      \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \color{blue}{\left(A - B\right)}\right)\right)}^{0.5}}{B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification23.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 5 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{-16 \cdot \left(F \cdot \left(C \cdot \left(A \cdot A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\right)\right)\right)}^{0.5}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 30.3% accurate, 5.1× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 1.95 \cdot 10^{-65}:\\ \;\;\;\;\frac{-1}{\frac{\frac{B\_m \cdot B\_m - A \cdot \left(4 \cdot C\right)}{A}}{\sqrt{-16 \cdot \left(C \cdot F\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 1.95e-65)
   (/ -1.0 (/ (/ (- (* B_m B_m) (* A (* 4.0 C))) A) (sqrt (* -16.0 (* C F)))))
   (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.95e-65) {
		tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / sqrt((-16.0 * (C * F))));
	} else {
		tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 1.95d-65) then
        tmp = (-1.0d0) / ((((b_m * b_m) - (a * (4.0d0 * c))) / a) / sqrt(((-16.0d0) * (c * f))))
    else
        tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.95e-65) {
		tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / Math.sqrt((-16.0 * (C * F))));
	} else {
		tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 1.95e-65:
		tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / math.sqrt((-16.0 * (C * F))))
	else:
		tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.95e-65)
		tmp = Float64(-1.0 / Float64(Float64(Float64(Float64(B_m * B_m) - Float64(A * Float64(4.0 * C))) / A) / sqrt(Float64(-16.0 * Float64(C * F)))));
	else
		tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.0 - B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 1.95e-65)
		tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / sqrt((-16.0 * (C * F))));
	else
		tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.95e-65], N[(-1.0 / N[(N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] - N[(A * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision] / N[Sqrt[N[(-16.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.95 \cdot 10^{-65}:\\
\;\;\;\;\frac{-1}{\frac{\frac{B\_m \cdot B\_m - A \cdot \left(4 \cdot C\right)}{A}}{\sqrt{-16 \cdot \left(C \cdot F\right)}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.9500000000000002e-65

    1. Initial program 21.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
    3. Simplified27.1%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
    4. Add Preprocessing
    5. Taylor expanded in A around -inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\left({A}^{2} \cdot \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)}\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left({A}^{2}\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{4}, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(A \cdot A\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\left(-16 \cdot \left(C \cdot F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \left(C \cdot F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \left(\frac{4 \cdot \left({B}^{2} \cdot F\right)}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\left(4 \cdot \left({B}^{2} \cdot F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left({B}^{2} \cdot F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\left({B}^{2}\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\left(B \cdot B\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
      12. *-lowering-*.f6413.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. Simplified13.2%

      \[\leadsto \frac{\sqrt{\color{blue}{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]
    8. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}}} \]
      2. metadata-evalN/A

        \[\leadsto \frac{-1 \cdot -1}{\frac{\color{blue}{4 \cdot \left(A \cdot C\right) - B \cdot B}}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot -1\right), \color{blue}{\left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}\right)}\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\color{blue}{4 \cdot \left(A \cdot C\right) - B \cdot B}}{\sqrt{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}\right)\right) \]
      5. pow1/2N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)\right)}^{\color{blue}{\frac{1}{2}}}}\right)\right) \]
      6. unpow-prod-downN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(A \cdot A\right)}^{\frac{1}{2}} \cdot \color{blue}{{\left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}^{\frac{1}{2}}}}\right)\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(A \cdot A\right)}^{\frac{1}{2}}}}{\color{blue}{{\left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}^{\frac{1}{2}}}}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{4 \cdot \left(A \cdot C\right) - B \cdot B}{{\left(A \cdot A\right)}^{\frac{1}{2}}}\right), \color{blue}{\left({\left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}^{\frac{1}{2}}\right)}\right)\right) \]
    9. Applied egg-rr6.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{F \cdot \left(-16 \cdot C\right) + \frac{F \cdot \left(\left(B \cdot B\right) \cdot 4\right)}{A}}}}} \]
    10. Taylor expanded in C around inf

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(A, \mathsf{*.f64}\left(C, 4\right)\right), \mathsf{*.f64}\left(B, B\right)\right), A\right), \mathsf{sqrt.f64}\left(\color{blue}{\left(-16 \cdot \left(C \cdot F\right)\right)}\right)\right)\right) \]
    11. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(A, \mathsf{*.f64}\left(C, 4\right)\right), \mathsf{*.f64}\left(B, B\right)\right), A\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \left(C \cdot F\right)\right)\right)\right)\right) \]
      2. *-lowering-*.f647.2%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(A, \mathsf{*.f64}\left(C, 4\right)\right), \mathsf{*.f64}\left(B, B\right)\right), A\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right)\right)\right)\right) \]
    12. Simplified7.2%

      \[\leadsto \frac{1}{\frac{\frac{A \cdot \left(C \cdot 4\right) - B \cdot B}{A}}{\sqrt{\color{blue}{-16 \cdot \left(C \cdot F\right)}}}} \]

    if 1.9500000000000002e-65 < B

    1. Initial program 13.5%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
      6. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
      12. accelerator-lowering-hypot.f6447.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
    5. Simplified47.7%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
      4. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
    7. Applied egg-rr47.8%

      \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
    8. Taylor expanded in A around 0

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \color{blue}{\left(A - B\right)}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    9. Step-by-step derivation
      1. --lowering--.f6445.5%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, B\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    10. Simplified45.5%

      \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \color{blue}{\left(A - B\right)}\right)\right)}^{0.5}}{B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification19.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.95 \cdot 10^{-65}:\\ \;\;\;\;\frac{-1}{\frac{\frac{B \cdot B - A \cdot \left(4 \cdot C\right)}{A}}{\sqrt{-16 \cdot \left(C \cdot F\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\right)\right)\right)}^{0.5}}{0 - B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 27.2% accurate, 5.7× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m)
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.0 - B_m))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}
\end{array}
Derivation
  1. Initial program 19.1%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in C around 0

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    5. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
    6. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    8. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
    12. accelerator-lowering-hypot.f6419.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
  5. Simplified19.0%

    \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  6. Step-by-step derivation
    1. associate-*l*N/A

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
    3. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
    4. associate-*l/N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
  7. Applied egg-rr19.1%

    \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  8. Taylor expanded in A around 0

    \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \color{blue}{\left(A - B\right)}\right)\right), \frac{1}{2}\right), B\right)\right) \]
  9. Step-by-step derivation
    1. --lowering--.f6416.5%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, B\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
  10. Simplified16.5%

    \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \color{blue}{\left(A - B\right)}\right)\right)}^{0.5}}{B} \]
  11. Final simplification16.5%

    \[\leadsto \frac{{\left(2 \cdot \left(F \cdot \left(A - B\right)\right)\right)}^{0.5}}{0 - B} \]
  12. Add Preprocessing

Alternative 10: 27.2% accurate, 5.7× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - B\_m\right)}}{0 - B\_m} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (/ (sqrt (* (* 2.0 F) (- A B_m))) (- 0.0 B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = sqrt(((2.0d0 * f) * (a - b_m))) / (0.0d0 - b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return Math.sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m);
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return math.sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m)
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - B_m))) / Float64(0.0 - B_m))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m);
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - B\_m\right)}}{0 - B\_m}
\end{array}
Derivation
  1. Initial program 19.1%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in C around 0

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    5. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
    6. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    8. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
    12. accelerator-lowering-hypot.f6419.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
  5. Simplified19.0%

    \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  6. Step-by-step derivation
    1. associate-*l*N/A

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
    3. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
    4. associate-*l/N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
  7. Applied egg-rr19.1%

    \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  8. Step-by-step derivation
    1. unpow1/2N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2 \cdot \left(F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)}\right), B\right)\right) \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(2 \cdot \left(F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right), B\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(2 \cdot F\right) \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)\right), B\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(A - \sqrt{B \cdot B + A \cdot A}\right) \cdot \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(A - \sqrt{B \cdot B + A \cdot A}\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    7. +-commutativeN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \left(\sqrt{A \cdot A + B \cdot B}\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    8. accelerator-lowering-hypot.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(A, B\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    9. *-lowering-*.f6419.0%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(A, B\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right), B\right)\right) \]
  9. Applied egg-rr19.0%

    \[\leadsto -\frac{\color{blue}{\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(2 \cdot F\right)}}}{B} \]
  10. Taylor expanded in A around 0

    \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(A - B\right)}, \mathsf{*.f64}\left(2, F\right)\right)\right), B\right)\right) \]
  11. Step-by-step derivation
    1. --lowering--.f6416.3%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, B\right), \mathsf{*.f64}\left(2, F\right)\right)\right), B\right)\right) \]
  12. Simplified16.3%

    \[\leadsto -\frac{\sqrt{\color{blue}{\left(A - B\right)} \cdot \left(2 \cdot F\right)}}{B} \]
  13. Final simplification16.3%

    \[\leadsto \frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - B\right)}}{0 - B} \]
  14. Add Preprocessing

Alternative 11: 26.8% accurate, 5.8× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{0 - B\_m} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (/ (sqrt (* -2.0 (* B_m F))) (- 0.0 B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return sqrt((-2.0 * (B_m * F))) / (0.0 - B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = sqrt(((-2.0d0) * (b_m * f))) / (0.0d0 - b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return Math.sqrt((-2.0 * (B_m * F))) / (0.0 - B_m);
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return math.sqrt((-2.0 * (B_m * F))) / (0.0 - B_m)
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(0.0 - B_m))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = sqrt((-2.0 * (B_m * F))) / (0.0 - B_m);
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{0 - B\_m}
\end{array}
Derivation
  1. Initial program 19.1%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in C around 0

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    5. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
    6. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    8. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
    12. accelerator-lowering-hypot.f6419.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
  5. Simplified19.0%

    \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  6. Step-by-step derivation
    1. associate-*l*N/A

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
    3. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
    4. associate-*l/N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
  7. Applied egg-rr19.1%

    \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  8. Step-by-step derivation
    1. unpow1/2N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2 \cdot \left(F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)}\right), B\right)\right) \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(2 \cdot \left(F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right), B\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(2 \cdot F\right) \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)\right)\right), B\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(A - \sqrt{B \cdot B + A \cdot A}\right) \cdot \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(A - \sqrt{B \cdot B + A \cdot A}\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    7. +-commutativeN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \left(\sqrt{A \cdot A + B \cdot B}\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    8. accelerator-lowering-hypot.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(A, B\right)\right), \left(2 \cdot F\right)\right)\right), B\right)\right) \]
    9. *-lowering-*.f6419.0%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(A, B\right)\right), \mathsf{*.f64}\left(2, F\right)\right)\right), B\right)\right) \]
  9. Applied egg-rr19.0%

    \[\leadsto -\frac{\color{blue}{\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(2 \cdot F\right)}}}{B} \]
  10. Taylor expanded in A around 0

    \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\left(-2 \cdot \left(B \cdot F\right)\right)}\right), B\right)\right) \]
  11. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-2, \left(B \cdot F\right)\right)\right), B\right)\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-2, \left(F \cdot B\right)\right)\right), B\right)\right) \]
    3. *-lowering-*.f6417.0%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(F, B\right)\right)\right), B\right)\right) \]
  12. Simplified17.0%

    \[\leadsto -\frac{\sqrt{\color{blue}{-2 \cdot \left(F \cdot B\right)}}}{B} \]
  13. Final simplification17.0%

    \[\leadsto \frac{\sqrt{-2 \cdot \left(B \cdot F\right)}}{0 - B} \]
  14. Add Preprocessing

Alternative 12: 9.5% accurate, 5.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{-2}{B\_m} \cdot \sqrt{A \cdot F} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F) :precision binary64 (* (/ -2.0 B_m) (sqrt (* A F))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (-2.0 / B_m) * sqrt((A * F));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = ((-2.0d0) / b_m) * sqrt((a * f))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return (-2.0 / B_m) * Math.sqrt((A * F));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (-2.0 / B_m) * math.sqrt((A * F))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(-2.0 / B_m) * sqrt(Float64(A * F)))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (-2.0 / B_m) * sqrt((A * F));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(-2.0 / B$95$m), $MachinePrecision] * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{-2}{B\_m} \cdot \sqrt{A \cdot F}
\end{array}
Derivation
  1. Initial program 19.1%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Step-by-step derivation
    1. distribute-frac-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\right) \]
    2. distribute-neg-frac2N/A

      \[\leadsto \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)}} \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right), \color{blue}{\left(\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)\right)}\right) \]
  3. Simplified23.9%

    \[\leadsto \color{blue}{\frac{\sqrt{\left(B \cdot B + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B \cdot B}} \]
  4. Add Preprocessing
  5. Taylor expanded in A around -inf

    \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\left({A}^{2} \cdot \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)}\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
  6. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left({A}^{2}\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{4}, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(A \cdot A\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \left(-16 \cdot \left(C \cdot F\right) + 4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\left(-16 \cdot \left(C \cdot F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \left(C \cdot F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \left(4 \cdot \frac{{B}^{2} \cdot F}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    7. associate-*r/N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \left(\frac{4 \cdot \left({B}^{2} \cdot F\right)}{A}\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\left(4 \cdot \left({B}^{2} \cdot F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left({B}^{2} \cdot F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\left({B}^{2}\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\left(B \cdot B\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
    12. *-lowering-*.f649.4%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(A, A\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(-16, \mathsf{*.f64}\left(C, F\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right)\right), A\right)\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(4, \mathsf{*.f64}\left(A, C\right)\right), \mathsf{*.f64}\left(B, B\right)\right)\right) \]
  7. Simplified9.4%

    \[\leadsto \frac{\sqrt{\color{blue}{\left(A \cdot A\right) \cdot \left(-16 \cdot \left(C \cdot F\right) + \frac{4 \cdot \left(\left(B \cdot B\right) \cdot F\right)}{A}\right)}}}{4 \cdot \left(A \cdot C\right) - B \cdot B} \]
  8. Taylor expanded in A around 0

    \[\leadsto \color{blue}{-2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)} \]
  9. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \color{blue}{\left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)}\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\left(\sqrt{A \cdot F}\right), \color{blue}{\left(\frac{1}{B}\right)}\right)\right) \]
    3. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(A \cdot F\right)\right), \left(\frac{\color{blue}{1}}{B}\right)\right)\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(A, F\right)\right), \left(\frac{1}{B}\right)\right)\right) \]
    5. /-lowering-/.f643.4%

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(A, F\right)\right), \mathsf{/.f64}\left(1, \color{blue}{B}\right)\right)\right) \]
  10. Simplified3.4%

    \[\leadsto \color{blue}{-2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)} \]
  11. Step-by-step derivation
    1. pow1/2N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\left({\left(A \cdot F\right)}^{\frac{1}{2}}\right), \mathsf{/.f64}\left(\color{blue}{1}, B\right)\right)\right) \]
    2. pow-to-expN/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\left(e^{\log \left(A \cdot F\right) \cdot \frac{1}{2}}\right), \mathsf{/.f64}\left(\color{blue}{1}, B\right)\right)\right) \]
    3. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\log \left(A \cdot F\right) \cdot \frac{1}{2}\right)\right), \mathsf{/.f64}\left(\color{blue}{1}, B\right)\right)\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(\log \left(A \cdot F\right), \frac{1}{2}\right)\right), \mathsf{/.f64}\left(1, B\right)\right)\right) \]
    5. log-lowering-log.f64N/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{log.f64}\left(\left(A \cdot F\right)\right), \frac{1}{2}\right)\right), \mathsf{/.f64}\left(1, B\right)\right)\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{log.f64}\left(\left(F \cdot A\right)\right), \frac{1}{2}\right)\right), \mathsf{/.f64}\left(1, B\right)\right)\right) \]
    7. *-lowering-*.f643.2%

      \[\leadsto \mathsf{*.f64}\left(-2, \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{log.f64}\left(\mathsf{*.f64}\left(F, A\right)\right), \frac{1}{2}\right)\right), \mathsf{/.f64}\left(1, B\right)\right)\right) \]
  12. Applied egg-rr3.2%

    \[\leadsto -2 \cdot \left(\color{blue}{e^{\log \left(F \cdot A\right) \cdot 0.5}} \cdot \frac{1}{B}\right) \]
  13. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto -2 \cdot \left(\frac{1}{B} \cdot \color{blue}{e^{\log \left(F \cdot A\right) \cdot \frac{1}{2}}}\right) \]
    2. associate-*r*N/A

      \[\leadsto \left(-2 \cdot \frac{1}{B}\right) \cdot \color{blue}{e^{\log \left(F \cdot A\right) \cdot \frac{1}{2}}} \]
    3. div-invN/A

      \[\leadsto \frac{-2}{B} \cdot e^{\color{blue}{\log \left(F \cdot A\right) \cdot \frac{1}{2}}} \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{-2}{B}\right), \color{blue}{\left(e^{\log \left(F \cdot A\right) \cdot \frac{1}{2}}\right)}\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-2, B\right), \left(e^{\color{blue}{\log \left(F \cdot A\right) \cdot \frac{1}{2}}}\right)\right) \]
    6. exp-prodN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-2, B\right), \left({\left(e^{\log \left(F \cdot A\right)}\right)}^{\color{blue}{\frac{1}{2}}}\right)\right) \]
    7. unpow1/2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-2, B\right), \left(\sqrt{e^{\log \left(F \cdot A\right)}}\right)\right) \]
    8. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-2, B\right), \mathsf{sqrt.f64}\left(\left(e^{\log \left(F \cdot A\right)}\right)\right)\right) \]
    9. rem-exp-logN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-2, B\right), \mathsf{sqrt.f64}\left(\left(F \cdot A\right)\right)\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-2, B\right), \mathsf{sqrt.f64}\left(\left(A \cdot F\right)\right)\right) \]
    11. *-lowering-*.f643.4%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-2, B\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(A, F\right)\right)\right) \]
  14. Applied egg-rr3.4%

    \[\leadsto \color{blue}{\frac{-2}{B} \cdot \sqrt{A \cdot F}} \]
  15. Add Preprocessing

Alternative 13: 4.1% accurate, 6.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ 0 - \sqrt{\frac{F}{A}} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F) :precision binary64 (- 0.0 (sqrt (/ F A))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return 0.0 - sqrt((F / A));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = 0.0d0 - sqrt((f / a))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return 0.0 - Math.sqrt((F / A));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return 0.0 - math.sqrt((F / A))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(0.0 - sqrt(Float64(F / A)))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = 0.0 - sqrt((F / A));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(0.0 - N[Sqrt[N[(F / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
0 - \sqrt{\frac{F}{A}}
\end{array}
Derivation
  1. Initial program 19.1%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in C around 0

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    5. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
    6. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    8. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
    12. accelerator-lowering-hypot.f6419.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
  5. Simplified19.0%

    \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  6. Step-by-step derivation
    1. associate-*l*N/A

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
    3. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
    4. associate-*l/N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
  7. Applied egg-rr19.1%

    \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  8. Taylor expanded in A around -inf

    \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\color{blue}{\left(-1 \cdot \left(A \cdot \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right)}, \frac{1}{2}\right), B\right)\right) \]
  9. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(\left(-1 \cdot A\right) \cdot \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(-1 \cdot A\right), \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    3. mul-1-negN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{neg}\left(A\right)\right), \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    4. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    5. mul-1-negN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \left(-4 \cdot F + \left(\mathsf{neg}\left(\frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    6. unsub-negN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \left(-4 \cdot F - \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\left(-4 \cdot F\right), \left(\frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \left(\frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\left({B}^{2} \cdot F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({B}^{2}\right), F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(B \cdot B\right), F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    13. unpow2N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right), \left(A \cdot A\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    14. *-lowering-*.f642.5%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right), \mathsf{*.f64}\left(A, A\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
  10. Simplified2.5%

    \[\leadsto -\frac{{\color{blue}{\left(\left(-A\right) \cdot \left(-4 \cdot F - \frac{\left(B \cdot B\right) \cdot F}{A \cdot A}\right)\right)}}^{0.5}}{B} \]
  11. Taylor expanded in B around -inf

    \[\leadsto \mathsf{neg.f64}\left(\color{blue}{\left(-1 \cdot \left(\sqrt{\frac{F}{A}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)}\right) \]
  12. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\left(-1 \cdot \sqrt{\frac{F}{A}}\right) \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) \]
    2. neg-mul-1N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\left(\mathsf{neg}\left(\sqrt{\frac{F}{A}}\right)\right) \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) \]
    3. unpow2N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\left(\mathsf{neg}\left(\sqrt{\frac{F}{A}}\right)\right) \cdot \left(\sqrt{-1} \cdot \sqrt{-1}\right)\right)\right) \]
    4. rem-square-sqrtN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\left(\mathsf{neg}\left(\sqrt{\frac{F}{A}}\right)\right) \cdot -1\right)\right) \]
    5. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\sqrt{\frac{F}{A}} \cdot -1\right)\right)\right) \]
    6. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\sqrt{\frac{F}{A}} \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\sqrt{\frac{F}{A}} \cdot 1\right)\right) \]
    8. *-rgt-identityN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\sqrt{\frac{F}{A}}\right)\right) \]
    9. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{F}{A}\right)\right)\right) \]
    10. /-lowering-/.f642.6%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(F, A\right)\right)\right) \]
  13. Simplified2.6%

    \[\leadsto -\color{blue}{\sqrt{\frac{F}{A}}} \]
  14. Final simplification2.6%

    \[\leadsto 0 - \sqrt{\frac{F}{A}} \]
  15. Add Preprocessing

Alternative 14: 1.5% accurate, 6.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \sqrt{\frac{F}{A}} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F) :precision binary64 (sqrt (/ F A)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return sqrt((F / A));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = sqrt((f / a))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return Math.sqrt((F / A));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return math.sqrt((F / A))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return sqrt(Float64(F / A))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = sqrt((F / A));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[Sqrt[N[(F / A), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{F}{A}}
\end{array}
Derivation
  1. Initial program 19.1%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in C around 0

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-1 \cdot \frac{\sqrt{2}}{B}\right), \color{blue}{\left(\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)}\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \left(\frac{\sqrt{2}}{B}\right)\right), \left(\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\left(\sqrt{2}\right), B\right)\right), \left(\sqrt{F \cdot \color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}\right)\right) \]
    5. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \left(\sqrt{F \cdot \left(\color{blue}{A} - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right) \]
    6. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right) \]
    8. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{A}^{2} + {B}^{2}}\right)\right)\right)\right)\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + {A}^{2}}\right)\right)\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \left(\sqrt{B \cdot B + A \cdot A}\right)\right)\right)\right)\right) \]
    12. accelerator-lowering-hypot.f6419.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(2\right), B\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(F, \mathsf{\_.f64}\left(A, \mathsf{hypot.f64}\left(B, A\right)\right)\right)\right)\right) \]
  5. Simplified19.0%

    \[\leadsto \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  6. Step-by-step derivation
    1. associate-*l*N/A

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)} \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right) \]
    3. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right)\right) \]
    4. associate-*l/N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}}{B}\right)\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{B \cdot B + A \cdot A}\right)}\right), B\right)\right) \]
  7. Applied egg-rr19.1%

    \[\leadsto \color{blue}{-\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
  8. Taylor expanded in A around -inf

    \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\color{blue}{\left(-1 \cdot \left(A \cdot \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right)}, \frac{1}{2}\right), B\right)\right) \]
  9. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(\left(-1 \cdot A\right) \cdot \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(-1 \cdot A\right), \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    3. mul-1-negN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{neg}\left(A\right)\right), \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    4. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \left(-4 \cdot F + -1 \cdot \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    5. mul-1-negN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \left(-4 \cdot F + \left(\mathsf{neg}\left(\frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    6. unsub-negN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \left(-4 \cdot F - \frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right), \frac{1}{2}\right), B\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\left(-4 \cdot F\right), \left(\frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \left(\frac{{B}^{2} \cdot F}{{A}^{2}}\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\left({B}^{2} \cdot F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({B}^{2}\right), F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(B \cdot B\right), F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right), \left({A}^{2}\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    13. unpow2N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right), \left(A \cdot A\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
    14. *-lowering-*.f642.5%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(A\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(-4, F\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(B, B\right), F\right), \mathsf{*.f64}\left(A, A\right)\right)\right)\right), \frac{1}{2}\right), B\right)\right) \]
  10. Simplified2.5%

    \[\leadsto -\frac{{\color{blue}{\left(\left(-A\right) \cdot \left(-4 \cdot F - \frac{\left(B \cdot B\right) \cdot F}{A \cdot A}\right)\right)}}^{0.5}}{B} \]
  11. Taylor expanded in A around 0

    \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{A}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
  12. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(-1 \cdot \sqrt{\frac{F}{A}}\right) \cdot \color{blue}{{\left(\sqrt{-1}\right)}^{2}} \]
    2. neg-mul-1N/A

      \[\leadsto \left(\mathsf{neg}\left(\sqrt{\frac{F}{A}}\right)\right) \cdot {\color{blue}{\left(\sqrt{-1}\right)}}^{2} \]
    3. unpow2N/A

      \[\leadsto \left(\mathsf{neg}\left(\sqrt{\frac{F}{A}}\right)\right) \cdot \left(\sqrt{-1} \cdot \color{blue}{\sqrt{-1}}\right) \]
    4. rem-square-sqrtN/A

      \[\leadsto \left(\mathsf{neg}\left(\sqrt{\frac{F}{A}}\right)\right) \cdot -1 \]
    5. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{neg}\left(\sqrt{\frac{F}{A}} \cdot -1\right) \]
    6. distribute-rgt-neg-inN/A

      \[\leadsto \sqrt{\frac{F}{A}} \cdot \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \]
    7. metadata-evalN/A

      \[\leadsto \sqrt{\frac{F}{A}} \cdot 1 \]
    8. *-rgt-identityN/A

      \[\leadsto \sqrt{\frac{F}{A}} \]
    9. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{F}{A}\right)\right) \]
    10. /-lowering-/.f641.0%

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(F, A\right)\right) \]
  13. Simplified1.0%

    \[\leadsto \color{blue}{\sqrt{\frac{F}{A}}} \]
  14. Add Preprocessing

Reproduce

?
herbie shell --seed 2024191 
(FPCore (A B C F)
  :name "ABCF->ab-angle b"
  :precision binary64
  (/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))