ABCF->ab-angle b

Percentage Accurate: 18.6% → 37.2%
Time: 10.4s
Alternatives: 13
Speedup: 7.2×

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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b, c, f)
use fmin_fmax_functions
    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}

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 13 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.6% 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b, c, f)
use fmin_fmax_functions
    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: 37.2% accurate, 1.6× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ t_1 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ \mathbf{if}\;C \leq -1.32 \cdot 10^{-47}:\\ \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(4 \cdot A, C, B \cdot B\right)} \cdot \sqrt{\left(\left(\left(\mathsf{hypot}\left(B, C - A\right) - C\right) - A\right) \cdot 2\right) \cdot F}}{t\_0}\\ \mathbf{elif}\;C \leq 4.6 \cdot 10^{-17}:\\ \;\;\;\;\frac{-\sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot 2\right)} \cdot \sqrt{\mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_1\right)}}{t\_1}\\ \end{array} \end{array} \]
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))) (t_1 (fma -4.0 (* C A) (* B B))))
   (if (<= C -1.32e-47)
     (/
      (-
       (*
        (sqrt (fma (* 4.0 A) C (* B B)))
        (sqrt (* (* (- (- (hypot B (- C A)) C) A) 2.0) F))))
      t_0)
     (if (<= C 4.6e-17)
       (/
        (-
         (*
          (sqrt (* (- (+ A C) (hypot (- A C) B)) (* F 2.0)))
          (sqrt (fma (* A C) -4.0 (* B B)))))
        t_0)
       (/
        (-
         (sqrt
          (* (- A (fma -1.0 A (* 0.5 (/ (pow B 2.0) C)))) (* (* 2.0 F) t_1))))
        t_1)))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	double t_1 = fma(-4.0, (C * A), (B * B));
	double tmp;
	if (C <= -1.32e-47) {
		tmp = -(sqrt(fma((4.0 * A), C, (B * B))) * sqrt(((((hypot(B, (C - A)) - C) - A) * 2.0) * F))) / t_0;
	} else if (C <= 4.6e-17) {
		tmp = -(sqrt((((A + C) - hypot((A - C), B)) * (F * 2.0))) * sqrt(fma((A * C), -4.0, (B * B)))) / t_0;
	} else {
		tmp = -sqrt(((A - fma(-1.0, A, (0.5 * (pow(B, 2.0) / C)))) * ((2.0 * F) * t_1))) / t_1;
	}
	return tmp;
}
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_1 = fma(-4.0, Float64(C * A), Float64(B * B))
	tmp = 0.0
	if (C <= -1.32e-47)
		tmp = Float64(Float64(-Float64(sqrt(fma(Float64(4.0 * A), C, Float64(B * B))) * sqrt(Float64(Float64(Float64(Float64(hypot(B, Float64(C - A)) - C) - A) * 2.0) * F)))) / t_0);
	elseif (C <= 4.6e-17)
		tmp = Float64(Float64(-Float64(sqrt(Float64(Float64(Float64(A + C) - hypot(Float64(A - C), B)) * Float64(F * 2.0))) * sqrt(fma(Float64(A * C), -4.0, Float64(B * B))))) / t_0);
	else
		tmp = Float64(Float64(-sqrt(Float64(Float64(A - fma(-1.0, A, Float64(0.5 * Float64((B ^ 2.0) / C)))) * Float64(Float64(2.0 * F) * t_1)))) / t_1);
	end
	return tmp
end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
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]}, Block[{t$95$1 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -1.32e-47], N[((-N[(N[Sqrt[N[(N[(4.0 * A), $MachinePrecision] * C + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(N[(N[(N[Sqrt[B ^ 2 + N[(C - A), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision] - A), $MachinePrecision] * 2.0), $MachinePrecision] * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 4.6e-17], N[((-N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(N[(A - N[(-1.0 * A + N[(0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
\mathbf{if}\;C \leq -1.32 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(4 \cdot A, C, B \cdot B\right)} \cdot \sqrt{\left(\left(\left(\mathsf{hypot}\left(B, C - A\right) - C\right) - A\right) \cdot 2\right) \cdot F}}{t\_0}\\

\mathbf{elif}\;C \leq 4.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot 2\right)} \cdot \sqrt{\mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)}}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_1\right)}}{t\_1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if C < -1.32e-47

    1. Initial program 14.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. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\color{blue}{\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. *-commutativeN/A

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

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

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

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

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

        \[\leadsto \frac{-\sqrt{-\color{blue}{\left(\sqrt{{\left(A - C\right)}^{2} + {B}^{2}} - \left(A + C\right)\right) \cdot \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Applied rewrites21.8%

      \[\leadsto \frac{-\sqrt{\color{blue}{-\left(\left(\mathsf{hypot}\left(A - C, B\right) - C\right) - A\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied rewrites30.3%

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

    if -1.32e-47 < C < 4.60000000000000018e-17

    1. Initial program 31.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. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\color{blue}{\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. lift--.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-+.f64N/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(\color{blue}{\left(A + C\right)} - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. associate--l+N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(A + \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. distribute-lft-inN/A

        \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot A + \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right), A, \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Applied rewrites40.1%

      \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right), A, \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied rewrites42.3%

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

    if 4.60000000000000018e-17 < C

    1. Initial program 6.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. Step-by-step derivation
      1. Applied rewrites7.5%

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

        \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
      3. Applied rewrites11.3%

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

        \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\left(-1 \cdot A + \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
      5. Step-by-step derivation
        1. lower-fma.f64N/A

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

          \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
        3. lower-/.f64N/A

          \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
        4. lift-pow.f6433.3

          \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
      6. Applied rewrites33.3%

        \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
    3. Recombined 3 regimes into one program.
    4. Add Preprocessing

    Alternative 2: 37.2% accurate, 1.6× speedup?

    \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ t_1 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ \mathbf{if}\;C \leq -1.32 \cdot 10^{-47}:\\ \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(4 \cdot A, C, B \cdot B\right) \cdot 2} \cdot \sqrt{F \cdot \left(\left(\mathsf{hypot}\left(B, C - A\right) - C\right) - A\right)}}{t\_0}\\ \mathbf{elif}\;C \leq 4.6 \cdot 10^{-17}:\\ \;\;\;\;\frac{-\sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot 2\right)} \cdot \sqrt{\mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_1\right)}}{t\_1}\\ \end{array} \end{array} \]
    NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
    (FPCore (A B C F)
     :precision binary64
     (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))) (t_1 (fma -4.0 (* C A) (* B B))))
       (if (<= C -1.32e-47)
         (/
          (-
           (*
            (sqrt (* (fma (* 4.0 A) C (* B B)) 2.0))
            (sqrt (* F (- (- (hypot B (- C A)) C) A)))))
          t_0)
         (if (<= C 4.6e-17)
           (/
            (-
             (*
              (sqrt (* (- (+ A C) (hypot (- A C) B)) (* F 2.0)))
              (sqrt (fma (* A C) -4.0 (* B B)))))
            t_0)
           (/
            (-
             (sqrt
              (* (- A (fma -1.0 A (* 0.5 (/ (pow B 2.0) C)))) (* (* 2.0 F) t_1))))
            t_1)))))
    assert(A < B && B < C && C < F);
    double code(double A, double B, double C, double F) {
    	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
    	double t_1 = fma(-4.0, (C * A), (B * B));
    	double tmp;
    	if (C <= -1.32e-47) {
    		tmp = -(sqrt((fma((4.0 * A), C, (B * B)) * 2.0)) * sqrt((F * ((hypot(B, (C - A)) - C) - A)))) / t_0;
    	} else if (C <= 4.6e-17) {
    		tmp = -(sqrt((((A + C) - hypot((A - C), B)) * (F * 2.0))) * sqrt(fma((A * C), -4.0, (B * B)))) / t_0;
    	} else {
    		tmp = -sqrt(((A - fma(-1.0, A, (0.5 * (pow(B, 2.0) / C)))) * ((2.0 * F) * t_1))) / t_1;
    	}
    	return tmp;
    }
    
    A, B, C, F = sort([A, B, C, F])
    function code(A, B, C, F)
    	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
    	t_1 = fma(-4.0, Float64(C * A), Float64(B * B))
    	tmp = 0.0
    	if (C <= -1.32e-47)
    		tmp = Float64(Float64(-Float64(sqrt(Float64(fma(Float64(4.0 * A), C, Float64(B * B)) * 2.0)) * sqrt(Float64(F * Float64(Float64(hypot(B, Float64(C - A)) - C) - A))))) / t_0);
    	elseif (C <= 4.6e-17)
    		tmp = Float64(Float64(-Float64(sqrt(Float64(Float64(Float64(A + C) - hypot(Float64(A - C), B)) * Float64(F * 2.0))) * sqrt(fma(Float64(A * C), -4.0, Float64(B * B))))) / t_0);
    	else
    		tmp = Float64(Float64(-sqrt(Float64(Float64(A - fma(-1.0, A, Float64(0.5 * Float64((B ^ 2.0) / C)))) * Float64(Float64(2.0 * F) * t_1)))) / t_1);
    	end
    	return tmp
    end
    
    NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
    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]}, Block[{t$95$1 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -1.32e-47], N[((-N[(N[Sqrt[N[(N[(N[(4.0 * A), $MachinePrecision] * C + N[(B * B), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F * N[(N[(N[Sqrt[B ^ 2 + N[(C - A), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 4.6e-17], N[((-N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(N[(A - N[(-1.0 * A + N[(0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]]
    
    \begin{array}{l}
    [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
    \\
    \begin{array}{l}
    t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
    t_1 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
    \mathbf{if}\;C \leq -1.32 \cdot 10^{-47}:\\
    \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(4 \cdot A, C, B \cdot B\right) \cdot 2} \cdot \sqrt{F \cdot \left(\left(\mathsf{hypot}\left(B, C - A\right) - C\right) - A\right)}}{t\_0}\\
    
    \mathbf{elif}\;C \leq 4.6 \cdot 10^{-17}:\\
    \;\;\;\;\frac{-\sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot 2\right)} \cdot \sqrt{\mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)}}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_1\right)}}{t\_1}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if C < -1.32e-47

      1. Initial program 14.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. lift-*.f64N/A

          \[\leadsto \frac{-\sqrt{\color{blue}{\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. *-commutativeN/A

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

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

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

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

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

          \[\leadsto \frac{-\sqrt{-\color{blue}{\left(\sqrt{{\left(A - C\right)}^{2} + {B}^{2}} - \left(A + C\right)\right) \cdot \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. Applied rewrites21.8%

        \[\leadsto \frac{-\sqrt{\color{blue}{-\left(\left(\mathsf{hypot}\left(A - C, B\right) - C\right) - A\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. Applied rewrites30.3%

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

      if -1.32e-47 < C < 4.60000000000000018e-17

      1. Initial program 31.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. lift-*.f64N/A

          \[\leadsto \frac{-\sqrt{\color{blue}{\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. lift--.f64N/A

          \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
        3. lift-+.f64N/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(\color{blue}{\left(A + C\right)} - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
        4. associate--l+N/A

          \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(A + \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
        5. distribute-lft-inN/A

          \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot A + \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
        6. lower-fma.f64N/A

          \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right), A, \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. Applied rewrites40.1%

        \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right), A, \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. Applied rewrites42.3%

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

      if 4.60000000000000018e-17 < C

      1. Initial program 6.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. Step-by-step derivation
        1. Applied rewrites7.5%

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

          \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
        3. Applied rewrites11.3%

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

          \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\left(-1 \cdot A + \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
        5. Step-by-step derivation
          1. lower-fma.f64N/A

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

            \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
          3. lower-/.f64N/A

            \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
          4. lift-pow.f6433.3

            \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
        6. Applied rewrites33.3%

          \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 3: 38.8% accurate, 1.6× speedup?

      \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ t_1 := \mathsf{hypot}\left(A - C, B\right)\\ \mathbf{if}\;C \leq -5.2 \cdot 10^{-263}:\\ \;\;\;\;\frac{-\sqrt{\left(\left(C + A\right) - t\_1\right) \cdot \left(\left(F + F\right) \cdot t\_0\right)}}{t\_0}\\ \mathbf{elif}\;C \leq 4.6 \cdot 10^{-17}:\\ \;\;\;\;\frac{-\sqrt{\left(\left(A + C\right) - t\_1\right) \cdot \left(F \cdot 2\right)} \cdot \sqrt{\mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_0\right)}}{t\_0}\\ \end{array} \end{array} \]
      NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
      (FPCore (A B C F)
       :precision binary64
       (let* ((t_0 (fma -4.0 (* C A) (* B B))) (t_1 (hypot (- A C) B)))
         (if (<= C -5.2e-263)
           (/ (- (sqrt (* (- (+ C A) t_1) (* (+ F F) t_0)))) t_0)
           (if (<= C 4.6e-17)
             (/
              (-
               (*
                (sqrt (* (- (+ A C) t_1) (* F 2.0)))
                (sqrt (fma (* A C) -4.0 (* B B)))))
              (- (pow B 2.0) (* (* 4.0 A) C)))
             (/
              (-
               (sqrt
                (* (- A (fma -1.0 A (* 0.5 (/ (pow B 2.0) C)))) (* (* 2.0 F) t_0))))
              t_0)))))
      assert(A < B && B < C && C < F);
      double code(double A, double B, double C, double F) {
      	double t_0 = fma(-4.0, (C * A), (B * B));
      	double t_1 = hypot((A - C), B);
      	double tmp;
      	if (C <= -5.2e-263) {
      		tmp = -sqrt((((C + A) - t_1) * ((F + F) * t_0))) / t_0;
      	} else if (C <= 4.6e-17) {
      		tmp = -(sqrt((((A + C) - t_1) * (F * 2.0))) * sqrt(fma((A * C), -4.0, (B * B)))) / (pow(B, 2.0) - ((4.0 * A) * C));
      	} else {
      		tmp = -sqrt(((A - fma(-1.0, A, (0.5 * (pow(B, 2.0) / C)))) * ((2.0 * F) * t_0))) / t_0;
      	}
      	return tmp;
      }
      
      A, B, C, F = sort([A, B, C, F])
      function code(A, B, C, F)
      	t_0 = fma(-4.0, Float64(C * A), Float64(B * B))
      	t_1 = hypot(Float64(A - C), B)
      	tmp = 0.0
      	if (C <= -5.2e-263)
      		tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(C + A) - t_1) * Float64(Float64(F + F) * t_0)))) / t_0);
      	elseif (C <= 4.6e-17)
      		tmp = Float64(Float64(-Float64(sqrt(Float64(Float64(Float64(A + C) - t_1) * Float64(F * 2.0))) * sqrt(fma(Float64(A * C), -4.0, Float64(B * B))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)));
      	else
      		tmp = Float64(Float64(-sqrt(Float64(Float64(A - fma(-1.0, A, Float64(0.5 * Float64((B ^ 2.0) / C)))) * Float64(Float64(2.0 * F) * t_0)))) / t_0);
      	end
      	return tmp
      end
      
      NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
      code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]}, If[LessEqual[C, -5.2e-263], N[((-N[Sqrt[N[(N[(N[(C + A), $MachinePrecision] - t$95$1), $MachinePrecision] * N[(N[(F + F), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 4.6e-17], N[((-N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] - t$95$1), $MachinePrecision] * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(A - N[(-1.0 * A + N[(0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
      
      \begin{array}{l}
      [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
      t_1 := \mathsf{hypot}\left(A - C, B\right)\\
      \mathbf{if}\;C \leq -5.2 \cdot 10^{-263}:\\
      \;\;\;\;\frac{-\sqrt{\left(\left(C + A\right) - t\_1\right) \cdot \left(\left(F + F\right) \cdot t\_0\right)}}{t\_0}\\
      
      \mathbf{elif}\;C \leq 4.6 \cdot 10^{-17}:\\
      \;\;\;\;\frac{-\sqrt{\left(\left(A + C\right) - t\_1\right) \cdot \left(F \cdot 2\right)} \cdot \sqrt{\mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_0\right)}}{t\_0}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if C < -5.2000000000000001e-263

        1. Initial program 25.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. Applied rewrites35.0%

            \[\leadsto \color{blue}{\frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}} \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

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

              \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
            3. lower-+.f6435.0

              \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
          3. Applied rewrites35.0%

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

          if -5.2000000000000001e-263 < C < 4.60000000000000018e-17

          1. Initial program 31.2%

            \[\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. lift-*.f64N/A

              \[\leadsto \frac{-\sqrt{\color{blue}{\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. lift--.f64N/A

              \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
            3. lift-+.f64N/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(\color{blue}{\left(A + C\right)} - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
            4. associate--l+N/A

              \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(A + \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
            5. distribute-lft-inN/A

              \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot A + \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
            6. lower-fma.f64N/A

              \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right), A, \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
          3. Applied rewrites38.8%

            \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right), A, \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
          4. Applied rewrites48.7%

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

          if 4.60000000000000018e-17 < C

          1. Initial program 6.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. Step-by-step derivation
            1. Applied rewrites7.5%

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

              \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
            3. Applied rewrites11.3%

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

              \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\left(-1 \cdot A + \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
            5. Step-by-step derivation
              1. lower-fma.f64N/A

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

                \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
              3. lower-/.f64N/A

                \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
              4. lift-pow.f6433.3

                \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
            6. Applied rewrites33.3%

              \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
          3. Recombined 3 regimes into one program.
          4. Add Preprocessing

          Alternative 4: 35.3% accurate, 2.4× speedup?

          \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ t_1 := \left(2 \cdot F\right) \cdot t\_0\\ \mathbf{if}\;C \leq 2.7 \cdot 10^{-61}:\\ \;\;\;\;\frac{-\sqrt{\left(A - \left(\mathsf{hypot}\left(A - C, B\right) - C\right)\right) \cdot t\_1}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot t\_1}}{t\_0}\\ \end{array} \end{array} \]
          NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
          (FPCore (A B C F)
           :precision binary64
           (let* ((t_0 (fma -4.0 (* C A) (* B B))) (t_1 (* (* 2.0 F) t_0)))
             (if (<= C 2.7e-61)
               (/ (- (sqrt (* (- A (- (hypot (- A C) B) C)) t_1))) t_0)
               (/ (- (sqrt (* (- A (fma -1.0 A (* 0.5 (/ (pow B 2.0) C)))) t_1))) t_0))))
          assert(A < B && B < C && C < F);
          double code(double A, double B, double C, double F) {
          	double t_0 = fma(-4.0, (C * A), (B * B));
          	double t_1 = (2.0 * F) * t_0;
          	double tmp;
          	if (C <= 2.7e-61) {
          		tmp = -sqrt(((A - (hypot((A - C), B) - C)) * t_1)) / t_0;
          	} else {
          		tmp = -sqrt(((A - fma(-1.0, A, (0.5 * (pow(B, 2.0) / C)))) * t_1)) / t_0;
          	}
          	return tmp;
          }
          
          A, B, C, F = sort([A, B, C, F])
          function code(A, B, C, F)
          	t_0 = fma(-4.0, Float64(C * A), Float64(B * B))
          	t_1 = Float64(Float64(2.0 * F) * t_0)
          	tmp = 0.0
          	if (C <= 2.7e-61)
          		tmp = Float64(Float64(-sqrt(Float64(Float64(A - Float64(hypot(Float64(A - C), B) - C)) * t_1))) / t_0);
          	else
          		tmp = Float64(Float64(-sqrt(Float64(Float64(A - fma(-1.0, A, Float64(0.5 * Float64((B ^ 2.0) / C)))) * t_1))) / t_0);
          	end
          	return tmp
          end
          
          NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
          code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[C, 2.7e-61], N[((-N[Sqrt[N[(N[(A - N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(N[(A - N[(-1.0 * A + N[(0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]
          
          \begin{array}{l}
          [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
          \\
          \begin{array}{l}
          t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
          t_1 := \left(2 \cdot F\right) \cdot t\_0\\
          \mathbf{if}\;C \leq 2.7 \cdot 10^{-61}:\\
          \;\;\;\;\frac{-\sqrt{\left(A - \left(\mathsf{hypot}\left(A - C, B\right) - C\right)\right) \cdot t\_1}}{t\_0}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot t\_1}}{t\_0}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if C < 2.69999999999999993e-61

            1. Initial program 29.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. Step-by-step derivation
              1. Applied rewrites37.8%

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

                \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
              3. Applied rewrites37.9%

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

              if 2.69999999999999993e-61 < C

              1. Initial program 8.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. Step-by-step derivation
                1. Applied rewrites9.8%

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

                  \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                3. Applied rewrites13.4%

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

                  \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\left(-1 \cdot A + \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                5. Step-by-step derivation
                  1. lower-fma.f64N/A

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

                    \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                  3. lower-/.f64N/A

                    \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, \frac{1}{2} \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                  4. lift-pow.f6432.8

                    \[\leadsto \frac{-\sqrt{\left(A - \mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                6. Applied rewrites32.8%

                  \[\leadsto \frac{-\sqrt{\left(A - \color{blue}{\mathsf{fma}\left(-1, A, 0.5 \cdot \frac{{B}^{2}}{C}\right)}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
              3. Recombined 2 regimes into one program.
              4. Add Preprocessing

              Alternative 5: 31.9% accurate, 2.6× speedup?

              \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ t_1 := \left(2 \cdot F\right) \cdot t\_0\\ \mathbf{if}\;C \leq 1.75 \cdot 10^{-64}:\\ \;\;\;\;\frac{-\sqrt{\left(A - \left(\mathsf{hypot}\left(A - C, B\right) - C\right)\right) \cdot t\_1}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot t\_1}}{t\_0}\\ \end{array} \end{array} \]
              NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
              (FPCore (A B C F)
               :precision binary64
               (let* ((t_0 (fma -4.0 (* C A) (* B B))) (t_1 (* (* 2.0 F) t_0)))
                 (if (<= C 1.75e-64)
                   (/ (- (sqrt (* (- A (- (hypot (- A C) B) C)) t_1))) t_0)
                   (/ (- (sqrt (* (* 2.0 A) t_1))) t_0))))
              assert(A < B && B < C && C < F);
              double code(double A, double B, double C, double F) {
              	double t_0 = fma(-4.0, (C * A), (B * B));
              	double t_1 = (2.0 * F) * t_0;
              	double tmp;
              	if (C <= 1.75e-64) {
              		tmp = -sqrt(((A - (hypot((A - C), B) - C)) * t_1)) / t_0;
              	} else {
              		tmp = -sqrt(((2.0 * A) * t_1)) / t_0;
              	}
              	return tmp;
              }
              
              A, B, C, F = sort([A, B, C, F])
              function code(A, B, C, F)
              	t_0 = fma(-4.0, Float64(C * A), Float64(B * B))
              	t_1 = Float64(Float64(2.0 * F) * t_0)
              	tmp = 0.0
              	if (C <= 1.75e-64)
              		tmp = Float64(Float64(-sqrt(Float64(Float64(A - Float64(hypot(Float64(A - C), B) - C)) * t_1))) / t_0);
              	else
              		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * A) * t_1))) / t_0);
              	end
              	return tmp
              end
              
              NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
              code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[C, 1.75e-64], N[((-N[Sqrt[N[(N[(A - N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(N[(2.0 * A), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]
              
              \begin{array}{l}
              [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
              \\
              \begin{array}{l}
              t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
              t_1 := \left(2 \cdot F\right) \cdot t\_0\\
              \mathbf{if}\;C \leq 1.75 \cdot 10^{-64}:\\
              \;\;\;\;\frac{-\sqrt{\left(A - \left(\mathsf{hypot}\left(A - C, B\right) - C\right)\right) \cdot t\_1}}{t\_0}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot t\_1}}{t\_0}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if C < 1.7500000000000002e-64

                1. Initial program 29.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. Step-by-step derivation
                  1. Applied rewrites37.8%

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

                    \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                  3. Applied rewrites37.9%

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

                  if 1.7500000000000002e-64 < C

                  1. Initial program 8.2%

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

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

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

                      \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot A\right)} \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                    4. Step-by-step derivation
                      1. lower-*.f6426.0

                        \[\leadsto \frac{-\sqrt{\left(2 \cdot \color{blue}{A}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                    5. Applied rewrites26.0%

                      \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot A\right)} \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                  3. Recombined 2 regimes into one program.
                  4. Add Preprocessing

                  Alternative 6: 31.3% accurate, 2.7× speedup?

                  \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ \mathbf{if}\;C \leq 2.2 \cdot 10^{-99}:\\ \;\;\;\;\frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\left(F + F\right) \cdot t\_0\right)}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_0\right)}}{t\_0}\\ \end{array} \end{array} \]
                  NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                  (FPCore (A B C F)
                   :precision binary64
                   (let* ((t_0 (fma -4.0 (* C A) (* B B))))
                     (if (<= C 2.2e-99)
                       (/ (- (sqrt (* (- (+ C A) (hypot (- A C) B)) (* (+ F F) t_0)))) t_0)
                       (/ (- (sqrt (* (* 2.0 A) (* (* 2.0 F) t_0)))) t_0))))
                  assert(A < B && B < C && C < F);
                  double code(double A, double B, double C, double F) {
                  	double t_0 = fma(-4.0, (C * A), (B * B));
                  	double tmp;
                  	if (C <= 2.2e-99) {
                  		tmp = -sqrt((((C + A) - hypot((A - C), B)) * ((F + F) * t_0))) / t_0;
                  	} else {
                  		tmp = -sqrt(((2.0 * A) * ((2.0 * F) * t_0))) / t_0;
                  	}
                  	return tmp;
                  }
                  
                  A, B, C, F = sort([A, B, C, F])
                  function code(A, B, C, F)
                  	t_0 = fma(-4.0, Float64(C * A), Float64(B * B))
                  	tmp = 0.0
                  	if (C <= 2.2e-99)
                  		tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(C + A) - hypot(Float64(A - C), B)) * Float64(Float64(F + F) * t_0)))) / t_0);
                  	else
                  		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * A) * Float64(Float64(2.0 * F) * t_0)))) / t_0);
                  	end
                  	return tmp
                  end
                  
                  NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                  code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, 2.2e-99], N[((-N[Sqrt[N[(N[(N[(C + A), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(F + F), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(N[(2.0 * A), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                  \\
                  \begin{array}{l}
                  t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
                  \mathbf{if}\;C \leq 2.2 \cdot 10^{-99}:\\
                  \;\;\;\;\frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\left(F + F\right) \cdot t\_0\right)}}{t\_0}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_0\right)}}{t\_0}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if C < 2.20000000000000004e-99

                    1. Initial program 28.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. Applied rewrites37.5%

                        \[\leadsto \color{blue}{\frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}} \]
                      2. Step-by-step derivation
                        1. lift-*.f64N/A

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

                          \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                        3. lower-+.f6437.5

                          \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                      3. Applied rewrites37.5%

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

                      if 2.20000000000000004e-99 < C

                      1. Initial program 10.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. Step-by-step derivation
                        1. Applied rewrites12.4%

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

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

                          \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot A\right)} \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                        4. Step-by-step derivation
                          1. lower-*.f6426.2

                            \[\leadsto \frac{-\sqrt{\left(2 \cdot \color{blue}{A}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                        5. Applied rewrites26.2%

                          \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot A\right)} \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                      3. Recombined 2 regimes into one program.
                      4. Add Preprocessing

                      Alternative 7: 28.3% accurate, 4.1× speedup?

                      \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ t_1 := \left(2 \cdot F\right) \cdot t\_0\\ t_2 := \sqrt{B - \left(A - C\right)}\\ \mathbf{if}\;C \leq 2.9 \cdot 10^{-66}:\\ \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(t\_2, -t\_2, A + C\right) \cdot t\_1}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot t\_1}}{t\_0}\\ \end{array} \end{array} \]
                      NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                      (FPCore (A B C F)
                       :precision binary64
                       (let* ((t_0 (fma -4.0 (* C A) (* B B)))
                              (t_1 (* (* 2.0 F) t_0))
                              (t_2 (sqrt (- B (- A C)))))
                         (if (<= C 2.9e-66)
                           (/ (- (sqrt (* (fma t_2 (- t_2) (+ A C)) t_1))) t_0)
                           (/ (- (sqrt (* (* 2.0 A) t_1))) t_0))))
                      assert(A < B && B < C && C < F);
                      double code(double A, double B, double C, double F) {
                      	double t_0 = fma(-4.0, (C * A), (B * B));
                      	double t_1 = (2.0 * F) * t_0;
                      	double t_2 = sqrt((B - (A - C)));
                      	double tmp;
                      	if (C <= 2.9e-66) {
                      		tmp = -sqrt((fma(t_2, -t_2, (A + C)) * t_1)) / t_0;
                      	} else {
                      		tmp = -sqrt(((2.0 * A) * t_1)) / t_0;
                      	}
                      	return tmp;
                      }
                      
                      A, B, C, F = sort([A, B, C, F])
                      function code(A, B, C, F)
                      	t_0 = fma(-4.0, Float64(C * A), Float64(B * B))
                      	t_1 = Float64(Float64(2.0 * F) * t_0)
                      	t_2 = sqrt(Float64(B - Float64(A - C)))
                      	tmp = 0.0
                      	if (C <= 2.9e-66)
                      		tmp = Float64(Float64(-sqrt(Float64(fma(t_2, Float64(-t_2), Float64(A + C)) * t_1))) / t_0);
                      	else
                      		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * A) * t_1))) / t_0);
                      	end
                      	return tmp
                      end
                      
                      NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                      code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(B - N[(A - C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[C, 2.9e-66], N[((-N[Sqrt[N[(N[(t$95$2 * (-t$95$2) + N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(N[(2.0 * A), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
                      
                      \begin{array}{l}
                      [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                      \\
                      \begin{array}{l}
                      t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
                      t_1 := \left(2 \cdot F\right) \cdot t\_0\\
                      t_2 := \sqrt{B - \left(A - C\right)}\\
                      \mathbf{if}\;C \leq 2.9 \cdot 10^{-66}:\\
                      \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(t\_2, -t\_2, A + C\right) \cdot t\_1}}{t\_0}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot t\_1}}{t\_0}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if C < 2.90000000000000011e-66

                        1. Initial program 29.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. Step-by-step derivation
                          1. Applied rewrites37.8%

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

                            \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                          3. Applied rewrites30.6%

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

                          if 2.90000000000000011e-66 < C

                          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. Step-by-step derivation
                            1. Applied rewrites10.2%

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

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

                              \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot A\right)} \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                            4. Step-by-step derivation
                              1. lower-*.f6426.1

                                \[\leadsto \frac{-\sqrt{\left(2 \cdot \color{blue}{A}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                            5. Applied rewrites26.1%

                              \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot A\right)} \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                          3. Recombined 2 regimes into one program.
                          4. Add Preprocessing

                          Alternative 8: 27.8% accurate, 6.0× speedup?

                          \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\ \mathbf{if}\;B \leq 9 \cdot 10^{+87}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_0\right)}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right)\\ \end{array} \end{array} \]
                          NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                          (FPCore (A B C F)
                           :precision binary64
                           (let* ((t_0 (fma -4.0 (* C A) (* B B))))
                             (if (<= B 9e+87)
                               (/ (- (sqrt (* (* 2.0 A) (* (* 2.0 F) t_0)))) t_0)
                               (*
                                -1.0
                                (* (/ (sqrt 2.0) B) (sqrt (* F (- C (sqrt (* (+ B C) (- B C)))))))))))
                          assert(A < B && B < C && C < F);
                          double code(double A, double B, double C, double F) {
                          	double t_0 = fma(-4.0, (C * A), (B * B));
                          	double tmp;
                          	if (B <= 9e+87) {
                          		tmp = -sqrt(((2.0 * A) * ((2.0 * F) * t_0))) / t_0;
                          	} else {
                          		tmp = -1.0 * ((sqrt(2.0) / B) * sqrt((F * (C - sqrt(((B + C) * (B - C)))))));
                          	}
                          	return tmp;
                          }
                          
                          A, B, C, F = sort([A, B, C, F])
                          function code(A, B, C, F)
                          	t_0 = fma(-4.0, Float64(C * A), Float64(B * B))
                          	tmp = 0.0
                          	if (B <= 9e+87)
                          		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * A) * Float64(Float64(2.0 * F) * t_0)))) / t_0);
                          	else
                          		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B) * sqrt(Float64(F * Float64(C - sqrt(Float64(Float64(B + C) * Float64(B - C))))))));
                          	end
                          	return tmp
                          end
                          
                          NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                          code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 9e+87], N[((-N[Sqrt[N[(N[(2.0 * A), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[Sqrt[N[(F * N[(C - N[Sqrt[N[(N[(B + C), $MachinePrecision] * N[(B - C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                          \\
                          \begin{array}{l}
                          t_0 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
                          \mathbf{if}\;B \leq 9 \cdot 10^{+87}:\\
                          \;\;\;\;\frac{-\sqrt{\left(2 \cdot A\right) \cdot \left(\left(2 \cdot F\right) \cdot t\_0\right)}}{t\_0}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right)\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if B < 9.0000000000000005e87

                            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. Applied rewrites27.0%

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

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

                                \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot A\right)} \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                              4. Step-by-step derivation
                                1. lower-*.f6431.1

                                  \[\leadsto \frac{-\sqrt{\left(2 \cdot \color{blue}{A}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                              5. Applied rewrites31.1%

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

                              if 9.0000000000000005e87 < B

                              1. Initial program 7.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. Applied rewrites9.1%

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

                                  \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                3. Step-by-step derivation
                                  1. lift-*.f64N/A

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

                                    \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                  3. lower-+.f646.4

                                    \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                4. Applied rewrites6.4%

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

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

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

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

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

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

                                    \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                  6. lower-*.f64N/A

                                    \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                  7. lower--.f64N/A

                                    \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                  8. lower-sqrt.f64N/A

                                    \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                  9. lower-*.f64N/A

                                    \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                  10. lower-+.f64N/A

                                    \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                  11. lower--.f6413.6

                                    \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                7. Applied rewrites13.6%

                                  \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right)} \]
                              3. Recombined 2 regimes into one program.
                              4. Add Preprocessing

                              Alternative 9: 25.4% accurate, 6.4× speedup?

                              \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B \leq 2.3 \cdot 10^{+79}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right)\\ \end{array} \end{array} \]
                              NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                              (FPCore (A B C F)
                               :precision binary64
                               (if (<= B 2.3e+79)
                                 (/
                                  (- (sqrt (* -8.0 (* A (* C (* F (- A (* -1.0 A))))))))
                                  (fma -4.0 (* C A) (* B B)))
                                 (*
                                  -1.0
                                  (* (/ (sqrt 2.0) B) (sqrt (* F (- C (sqrt (* (+ B C) (- B C))))))))))
                              assert(A < B && B < C && C < F);
                              double code(double A, double B, double C, double F) {
                              	double tmp;
                              	if (B <= 2.3e+79) {
                              		tmp = -sqrt((-8.0 * (A * (C * (F * (A - (-1.0 * A))))))) / fma(-4.0, (C * A), (B * B));
                              	} else {
                              		tmp = -1.0 * ((sqrt(2.0) / B) * sqrt((F * (C - sqrt(((B + C) * (B - C)))))));
                              	}
                              	return tmp;
                              }
                              
                              A, B, C, F = sort([A, B, C, F])
                              function code(A, B, C, F)
                              	tmp = 0.0
                              	if (B <= 2.3e+79)
                              		tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(A * Float64(C * Float64(F * Float64(A - Float64(-1.0 * A)))))))) / fma(-4.0, Float64(C * A), Float64(B * B)));
                              	else
                              		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B) * sqrt(Float64(F * Float64(C - sqrt(Float64(Float64(B + C) * Float64(B - C))))))));
                              	end
                              	return tmp
                              end
                              
                              NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                              code[A_, B_, C_, F_] := If[LessEqual[B, 2.3e+79], N[((-N[Sqrt[N[(-8.0 * N[(A * N[(C * N[(F * N[(A - N[(-1.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[Sqrt[N[(F * N[(C - N[Sqrt[N[(N[(B + C), $MachinePrecision] * N[(B - C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                              
                              \begin{array}{l}
                              [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;B \leq 2.3 \cdot 10^{+79}:\\
                              \;\;\;\;\frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right)\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if B < 2.3e79

                                1. Initial program 21.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. Step-by-step derivation
                                  1. Applied rewrites27.0%

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

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

                                    \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                  4. Step-by-step derivation
                                    1. lower-*.f64N/A

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

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

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

                                      \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                    5. lower--.f64N/A

                                      \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - \color{blue}{-1 \cdot A}\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                    6. lower-*.f6427.9

                                      \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot \color{blue}{A}\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                  5. Applied rewrites27.9%

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

                                  if 2.3e79 < B

                                  1. Initial program 8.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. Step-by-step derivation
                                    1. Applied rewrites9.9%

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

                                      \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                    3. Step-by-step derivation
                                      1. lift-*.f64N/A

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

                                        \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                      3. lower-+.f647.3

                                        \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                    4. Applied rewrites7.3%

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

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

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

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

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

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

                                        \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                      6. lower-*.f64N/A

                                        \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                      7. lower--.f64N/A

                                        \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                      8. lower-sqrt.f64N/A

                                        \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                      9. lower-*.f64N/A

                                        \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                      10. lower-+.f64N/A

                                        \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                      11. lower--.f6414.8

                                        \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right) \]
                                    7. Applied rewrites14.8%

                                      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\left(B + C\right) \cdot \left(B - C\right)}\right)}\right)} \]
                                  3. Recombined 2 regimes into one program.
                                  4. Add Preprocessing

                                  Alternative 10: 25.3% accurate, 6.4× speedup?

                                  \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B \leq 2.3 \cdot 10^{+79}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right)\\ \end{array} \end{array} \]
                                  NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                  (FPCore (A B C F)
                                   :precision binary64
                                   (if (<= B 2.3e+79)
                                     (/
                                      (- (sqrt (* -8.0 (* A (* C (* F (- A (* -1.0 A))))))))
                                      (fma -4.0 (* C A) (* B B)))
                                     (*
                                      -1.0
                                      (* (/ (sqrt 2.0) B) (sqrt (* F (- A (sqrt (* (+ A B) (- B A))))))))))
                                  assert(A < B && B < C && C < F);
                                  double code(double A, double B, double C, double F) {
                                  	double tmp;
                                  	if (B <= 2.3e+79) {
                                  		tmp = -sqrt((-8.0 * (A * (C * (F * (A - (-1.0 * A))))))) / fma(-4.0, (C * A), (B * B));
                                  	} else {
                                  		tmp = -1.0 * ((sqrt(2.0) / B) * sqrt((F * (A - sqrt(((A + B) * (B - A)))))));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  A, B, C, F = sort([A, B, C, F])
                                  function code(A, B, C, F)
                                  	tmp = 0.0
                                  	if (B <= 2.3e+79)
                                  		tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(A * Float64(C * Float64(F * Float64(A - Float64(-1.0 * A)))))))) / fma(-4.0, Float64(C * A), Float64(B * B)));
                                  	else
                                  		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B) * sqrt(Float64(F * Float64(A - sqrt(Float64(Float64(A + B) * Float64(B - A))))))));
                                  	end
                                  	return tmp
                                  end
                                  
                                  NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                  code[A_, B_, C_, F_] := If[LessEqual[B, 2.3e+79], N[((-N[Sqrt[N[(-8.0 * N[(A * N[(C * N[(F * N[(A - N[(-1.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[Sqrt[N[(F * N[(A - N[Sqrt[N[(N[(A + B), $MachinePrecision] * N[(B - A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;B \leq 2.3 \cdot 10^{+79}:\\
                                  \;\;\;\;\frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right)\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if B < 2.3e79

                                    1. Initial program 21.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. Step-by-step derivation
                                      1. Applied rewrites27.0%

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

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

                                        \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                      4. Step-by-step derivation
                                        1. lower-*.f64N/A

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

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

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

                                          \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                        5. lower--.f64N/A

                                          \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - \color{blue}{-1 \cdot A}\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                        6. lower-*.f6427.9

                                          \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot \color{blue}{A}\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                      5. Applied rewrites27.9%

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

                                      if 2.3e79 < B

                                      1. Initial program 8.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. Step-by-step derivation
                                        1. Applied rewrites9.9%

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

                                          \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \color{blue}{\sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}}\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                        3. Step-by-step derivation
                                          1. lift-*.f64N/A

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

                                            \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                          3. lower-+.f647.3

                                            \[\leadsto \frac{-\sqrt{\left(\left(C + A\right) - \sqrt{B + \left(C - A\right)} \cdot \sqrt{B - \left(C - A\right)}\right) \cdot \left(\color{blue}{\left(F + F\right)} \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                        4. Applied rewrites7.3%

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

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

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

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

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

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

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

                                            \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right) \]
                                          7. lower--.f64N/A

                                            \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right) \]
                                          8. lower-sqrt.f64N/A

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

                                            \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right) \]
                                          10. lower-+.f64N/A

                                            \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right) \]
                                          11. lower--.f6414.7

                                            \[\leadsto -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right) \]
                                        7. Applied rewrites14.7%

                                          \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\left(A + B\right) \cdot \left(B - A\right)}\right)}\right)} \]
                                      3. Recombined 2 regimes into one program.
                                      4. Add Preprocessing

                                      Alternative 11: 23.2% accurate, 7.2× speedup?

                                      \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \end{array} \]
                                      NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                      (FPCore (A B C F)
                                       :precision binary64
                                       (/
                                        (- (sqrt (* -8.0 (* A (* C (* F (- A (* -1.0 A))))))))
                                        (fma -4.0 (* C A) (* B B))))
                                      assert(A < B && B < C && C < F);
                                      double code(double A, double B, double C, double F) {
                                      	return -sqrt((-8.0 * (A * (C * (F * (A - (-1.0 * A))))))) / fma(-4.0, (C * A), (B * B));
                                      }
                                      
                                      A, B, C, F = sort([A, B, C, F])
                                      function code(A, B, C, F)
                                      	return Float64(Float64(-sqrt(Float64(-8.0 * Float64(A * Float64(C * Float64(F * Float64(A - Float64(-1.0 * A)))))))) / fma(-4.0, Float64(C * A), Float64(B * B)))
                                      end
                                      
                                      NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                      code[A_, B_, C_, F_] := N[((-N[Sqrt[N[(-8.0 * N[(A * N[(C * N[(F * N[(A - N[(-1.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                      
                                      \begin{array}{l}
                                      [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                                      \\
                                      \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 18.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. Applied rewrites23.7%

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

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

                                          \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                        4. Step-by-step derivation
                                          1. lower-*.f64N/A

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

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

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

                                            \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                          5. lower--.f64N/A

                                            \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - \color{blue}{-1 \cdot A}\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                          6. lower-*.f6423.2

                                            \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot \color{blue}{A}\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                        5. Applied rewrites23.2%

                                          \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \]
                                        6. Add Preprocessing

                                        Alternative 12: 3.8% accurate, 8.5× speedup?

                                        \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ 0.25 \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-4, C, 4 \cdot C\right)}\right) \end{array} \]
                                        NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                        (FPCore (A B C F)
                                         :precision binary64
                                         (* 0.25 (* (/ (sqrt 2.0) C) (sqrt (* F (fma -4.0 C (* 4.0 C)))))))
                                        assert(A < B && B < C && C < F);
                                        double code(double A, double B, double C, double F) {
                                        	return 0.25 * ((sqrt(2.0) / C) * sqrt((F * fma(-4.0, C, (4.0 * C)))));
                                        }
                                        
                                        A, B, C, F = sort([A, B, C, F])
                                        function code(A, B, C, F)
                                        	return Float64(0.25 * Float64(Float64(sqrt(2.0) / C) * sqrt(Float64(F * fma(-4.0, C, Float64(4.0 * C))))))
                                        end
                                        
                                        NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                        code[A_, B_, C_, F_] := N[(0.25 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / C), $MachinePrecision] * N[Sqrt[N[(F * N[(-4.0 * C + N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                        
                                        \begin{array}{l}
                                        [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                                        \\
                                        0.25 \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-4, C, 4 \cdot C\right)}\right)
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 18.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. lift-*.f64N/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\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. lift--.f64N/A

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          3. lift-+.f64N/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(\color{blue}{\left(A + C\right)} - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          4. associate--l+N/A

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(A + \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          5. distribute-lft-inN/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot A + \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          6. lower-fma.f64N/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right), A, \left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                        3. Applied rewrites25.4%

                                          \[\leadsto \frac{-\sqrt{\color{blue}{\mathsf{fma}\left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right), A, \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                        4. Step-by-step derivation
                                          1. lift-fma.f64N/A

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

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)} \cdot A + \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          3. associate-*l*N/A

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

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A\right) + \color{blue}{\left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          5. lift-*.f64N/A

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A\right) + \color{blue}{\left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)} \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          6. associate-*l*N/A

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A\right) + \color{blue}{\left(2 \cdot F\right) \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          7. distribute-lft-outN/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot F\right) \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A + \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          8. lower-*.f64N/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot F\right) \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A + \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          9. lift-*.f64N/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\left(2 \cdot F\right)} \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A + \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          10. *-commutativeN/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\left(F \cdot 2\right)} \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A + \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          11. lower-*.f64N/A

                                            \[\leadsto \frac{-\sqrt{\color{blue}{\left(F \cdot 2\right)} \cdot \left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot A + \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          12. lower-fma.f64N/A

                                            \[\leadsto \frac{-\sqrt{\left(F \cdot 2\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right), A, \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right) \cdot \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                        5. Applied rewrites21.0%

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

                                          \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \left(-4 \cdot C + 4 \cdot C\right)}\right)} \]
                                        7. Step-by-step derivation
                                          1. lower-*.f64N/A

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

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

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

                                            \[\leadsto \frac{1}{4} \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{\color{blue}{F} \cdot \left(-4 \cdot C + 4 \cdot C\right)}\right) \]
                                          5. lower-sqrt.f64N/A

                                            \[\leadsto \frac{1}{4} \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \left(-4 \cdot C + 4 \cdot C\right)}\right) \]
                                          6. lower-*.f64N/A

                                            \[\leadsto \frac{1}{4} \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \left(-4 \cdot C + 4 \cdot C\right)}\right) \]
                                          7. lower-fma.f64N/A

                                            \[\leadsto \frac{1}{4} \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-4, C, 4 \cdot C\right)}\right) \]
                                          8. lower-*.f643.8

                                            \[\leadsto 0.25 \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-4, C, 4 \cdot C\right)}\right) \]
                                        8. Applied rewrites3.8%

                                          \[\leadsto \color{blue}{0.25 \cdot \left(\frac{\sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-4, C, 4 \cdot C\right)}\right)} \]
                                        9. Add Preprocessing

                                        Alternative 13: 13.7% accurate, 11.7× speedup?

                                        \[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ -1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right) \end{array} \]
                                        NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                        (FPCore (A B C F) :precision binary64 (* -1.0 (* (sqrt (/ F B)) (sqrt 2.0))))
                                        assert(A < B && B < C && C < F);
                                        double code(double A, double B, double C, double F) {
                                        	return -1.0 * (sqrt((F / B)) * sqrt(2.0));
                                        }
                                        
                                        NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                        module fmin_fmax_functions
                                            implicit none
                                            private
                                            public fmax
                                            public fmin
                                        
                                            interface fmax
                                                module procedure fmax88
                                                module procedure fmax44
                                                module procedure fmax84
                                                module procedure fmax48
                                            end interface
                                            interface fmin
                                                module procedure fmin88
                                                module procedure fmin44
                                                module procedure fmin84
                                                module procedure fmin48
                                            end interface
                                        contains
                                            real(8) function fmax88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmax44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmax84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmax48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmin44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmin48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                            end function
                                        end module
                                        
                                        real(8) function code(a, b, c, f)
                                        use fmin_fmax_functions
                                            real(8), intent (in) :: a
                                            real(8), intent (in) :: b
                                            real(8), intent (in) :: c
                                            real(8), intent (in) :: f
                                            code = (-1.0d0) * (sqrt((f / b)) * sqrt(2.0d0))
                                        end function
                                        
                                        assert A < B && B < C && C < F;
                                        public static double code(double A, double B, double C, double F) {
                                        	return -1.0 * (Math.sqrt((F / B)) * Math.sqrt(2.0));
                                        }
                                        
                                        [A, B, C, F] = sort([A, B, C, F])
                                        def code(A, B, C, F):
                                        	return -1.0 * (math.sqrt((F / B)) * math.sqrt(2.0))
                                        
                                        A, B, C, F = sort([A, B, C, F])
                                        function code(A, B, C, F)
                                        	return Float64(-1.0 * Float64(sqrt(Float64(F / B)) * sqrt(2.0)))
                                        end
                                        
                                        A, B, C, F = num2cell(sort([A, B, C, F])){:}
                                        function tmp = code(A, B, C, F)
                                        	tmp = -1.0 * (sqrt((F / B)) * sqrt(2.0));
                                        end
                                        
                                        NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
                                        code[A_, B_, C_, F_] := N[(-1.0 * N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                        
                                        \begin{array}{l}
                                        [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
                                        \\
                                        -1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 18.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. lift--.f64N/A

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \color{blue}{\left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          2. lift-+.f64N/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(\color{blue}{\left(A + C\right)} - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          3. +-commutativeN/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(\color{blue}{\left(C + A\right)} - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          4. associate--l+N/A

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

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

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C + \color{blue}{\left(A - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          7. lift-sqrt.f64N/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(C + \left(A - \color{blue}{\sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          8. lift-+.f64N/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(C + \left(A - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          9. lift-pow.f64N/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(C + \left(A - \sqrt{\color{blue}{{\left(A - C\right)}^{2}} + {B}^{2}}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          10. unpow2N/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(C + \left(A - \sqrt{\color{blue}{\left(A - C\right) \cdot \left(A - C\right)} + {B}^{2}}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          11. lift-pow.f64N/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(C + \left(A - \sqrt{\left(A - C\right) \cdot \left(A - C\right) + \color{blue}{{B}^{2}}}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          12. unpow2N/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(C + \left(A - \sqrt{\left(A - C\right) \cdot \left(A - C\right) + \color{blue}{B \cdot B}}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                          13. lower-hypot.f6423.7

                                            \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(C + \left(A - \color{blue}{\mathsf{hypot}\left(A - C, B\right)}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                        3. Applied rewrites23.7%

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

                                          \[\leadsto \frac{-\sqrt{\left(2 \cdot \color{blue}{\left(-\mathsf{fma}\left(4 \cdot A, C, B \cdot B\right) \cdot F\right)}\right) \cdot \left(C + \left(A - \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
                                        5. Applied rewrites8.3%

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

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

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

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

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

                                            \[\leadsto -1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right) \]
                                          5. lower-sqrt.f6413.7

                                            \[\leadsto -1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right) \]
                                        8. Applied rewrites13.7%

                                          \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
                                        9. Add Preprocessing

                                        Reproduce

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