ABCF->ab-angle b

Percentage Accurate: 19.4% → 52.5%
Time: 21.8s
Alternatives: 10
Speedup: 11.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 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: 19.4% accurate, 1.0× speedup?

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

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

Alternative 1: 52.5% accurate, 0.2× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := {\left(\mathsf{fma}\left(A - C, A - C, B \cdot B\right)\right)}^{0.25}\\ t_1 := \left(4 \cdot A\right) \cdot C\\ t_2 := 2 \cdot \left(\left({B}^{2} - t\_1\right) \cdot F\right)\\ t_3 := t\_1 - {B}^{2}\\ t_4 := \frac{\sqrt{t\_2 \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3}\\ t_5 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\ t_6 := -0.25 \cdot \left(t\_5 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\ t_7 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;t\_6\\ \mathbf{elif}\;t\_4 \leq -4 \cdot 10^{-201}:\\ \;\;\;\;\frac{\sqrt{t\_2 \cdot \mathsf{fma}\left(t\_0, 0 - t\_0, A + C\right)}}{t\_3}\\ \mathbf{elif}\;t\_4 \leq 4 \cdot 10^{+226}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B \cdot B, \frac{-0.5}{C}, A + A\right) \cdot \left(t\_7 \cdot \left(2 \cdot F\right)\right)}}{0 - t\_7}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;-0.25 \cdot \left(t\_5 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_6\\ \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 (fma (- A C) (- A C) (* B B)) 0.25))
        (t_1 (* (* 4.0 A) C))
        (t_2 (* 2.0 (* (- (pow B 2.0) t_1) F)))
        (t_3 (- t_1 (pow B 2.0)))
        (t_4
         (/
          (sqrt (* t_2 (- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))))
          t_3))
        (t_5 (/ (* (sqrt 2.0) (sqrt 2.0)) C))
        (t_6 (* -0.25 (* t_5 (* (sqrt (* F -4.0)) (sqrt C)))))
        (t_7 (fma B B (* A (* C -4.0)))))
   (if (<= t_4 (- INFINITY))
     t_6
     (if (<= t_4 -4e-201)
       (/ (sqrt (* t_2 (fma t_0 (- 0.0 t_0) (+ A C)))) t_3)
       (if (<= t_4 4e+226)
         (/
          (sqrt (* (fma (* B B) (/ -0.5 C) (+ A A)) (* t_7 (* 2.0 F))))
          (- 0.0 t_7))
         (if (<= t_4 INFINITY)
           (* -0.25 (* t_5 (* (sqrt (* C -2.0)) (sqrt (+ F F)))))
           t_6))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double t_0 = pow(fma((A - C), (A - C), (B * B)), 0.25);
	double t_1 = (4.0 * A) * C;
	double t_2 = 2.0 * ((pow(B, 2.0) - t_1) * F);
	double t_3 = t_1 - pow(B, 2.0);
	double t_4 = sqrt((t_2 * ((A + C) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_3;
	double t_5 = (sqrt(2.0) * sqrt(2.0)) / C;
	double t_6 = -0.25 * (t_5 * (sqrt((F * -4.0)) * sqrt(C)));
	double t_7 = fma(B, B, (A * (C * -4.0)));
	double tmp;
	if (t_4 <= -((double) INFINITY)) {
		tmp = t_6;
	} else if (t_4 <= -4e-201) {
		tmp = sqrt((t_2 * fma(t_0, (0.0 - t_0), (A + C)))) / t_3;
	} else if (t_4 <= 4e+226) {
		tmp = sqrt((fma((B * B), (-0.5 / C), (A + A)) * (t_7 * (2.0 * F)))) / (0.0 - t_7);
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = -0.25 * (t_5 * (sqrt((C * -2.0)) * sqrt((F + F))));
	} else {
		tmp = t_6;
	}
	return tmp;
}
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	t_0 = fma(Float64(A - C), Float64(A - C), Float64(B * B)) ^ 0.25
	t_1 = Float64(Float64(4.0 * A) * C)
	t_2 = Float64(2.0 * Float64(Float64((B ^ 2.0) - t_1) * F))
	t_3 = Float64(t_1 - (B ^ 2.0))
	t_4 = Float64(sqrt(Float64(t_2 * Float64(Float64(A + C) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / t_3)
	t_5 = Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C)
	t_6 = Float64(-0.25 * Float64(t_5 * Float64(sqrt(Float64(F * -4.0)) * sqrt(C))))
	t_7 = fma(B, B, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if (t_4 <= Float64(-Inf))
		tmp = t_6;
	elseif (t_4 <= -4e-201)
		tmp = Float64(sqrt(Float64(t_2 * fma(t_0, Float64(0.0 - t_0), Float64(A + C)))) / t_3);
	elseif (t_4 <= 4e+226)
		tmp = Float64(sqrt(Float64(fma(Float64(B * B), Float64(-0.5 / C), Float64(A + A)) * Float64(t_7 * Float64(2.0 * F)))) / Float64(0.0 - t_7));
	elseif (t_4 <= Inf)
		tmp = Float64(-0.25 * Float64(t_5 * Float64(sqrt(Float64(C * -2.0)) * sqrt(Float64(F + F)))));
	else
		tmp = t_6;
	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[Power[N[(N[(A - C), $MachinePrecision] * N[(A - C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 - N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(t$95$2 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]}, Block[{t$95$6 = N[(-0.25 * N[(t$95$5 * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$6, If[LessEqual[t$95$4, -4e-201], N[(N[Sqrt[N[(t$95$2 * N[(t$95$0 * N[(0.0 - t$95$0), $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$4, 4e+226], N[(N[Sqrt[N[(N[(N[(B * B), $MachinePrecision] * N[(-0.5 / C), $MachinePrecision] + N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(t$95$7 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - t$95$7), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(-0.25 * N[(t$95$5 * N[(N[Sqrt[N[(C * -2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F + F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$6]]]]]]]]]]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(A - C, A - C, B \cdot B\right)\right)}^{0.25}\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := 2 \cdot \left(\left({B}^{2} - t\_1\right) \cdot F\right)\\
t_3 := t\_1 - {B}^{2}\\
t_4 := \frac{\sqrt{t\_2 \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3}\\
t_5 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\
t_6 := -0.25 \cdot \left(t\_5 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\
t_7 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_6\\

\mathbf{elif}\;t\_4 \leq -4 \cdot 10^{-201}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \mathsf{fma}\left(t\_0, 0 - t\_0, A + C\right)}}{t\_3}\\

\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{+226}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B \cdot B, \frac{-0.5}{C}, A + A\right) \cdot \left(t\_7 \cdot \left(2 \cdot F\right)\right)}}{0 - t\_7}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;-0.25 \cdot \left(t\_5 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_6\\


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

    1. Initial program 1.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr0.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6413.0

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified13.0%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
      11. sqrt-lowering-sqrt.f6417.8

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
    9. Applied egg-rr17.8%

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

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

    1. Initial program 98.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. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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) + \left(\mathsf{neg}\left(\sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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(\mathsf{neg}\left(\sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right) + \left(A + C\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. pow1/2N/A

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\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({\left(A - C\right)}^{2} + {B}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot \left(\mathsf{neg}\left({\left({\left(A - C\right)}^{2} + {B}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}\right)\right)} + \left(A + C\right)\right)}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. accelerator-lowering-fma.f64N/A

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

      \[\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}{\mathsf{fma}\left({\left(\mathsf{fma}\left(A - C, A - C, B \cdot B\right)\right)}^{0.25}, -{\left(\mathsf{fma}\left(A - C, A - C, B \cdot B\right)\right)}^{0.25}, A + C\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]

    if -3.99999999999999978e-201 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < 3.99999999999999985e226

    1. Initial program 27.4%

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

      \[\leadsto \frac{\mathsf{neg}\left(\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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{\mathsf{neg}\left(\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(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} - -1 \cdot A\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\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(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, \frac{-1}{2}, A\right)\right)}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      12. *-lowering-*.f6433.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(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, -0.5, A\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Simplified33.6%

      \[\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 + \mathsf{fma}\left(\frac{B \cdot B}{C}, -0.5, A\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Step-by-step derivation
      1. distribute-frac-negN/A

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

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

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(A + \left(\frac{B \cdot B}{C} \cdot \frac{-1}{2} + A\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}}\right) \]
    7. Applied egg-rr33.6%

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

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

    1. Initial program 8.4%

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

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr0.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6469.9

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

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{-2 \cdot C} \cdot \color{blue}{\sqrt{F + F}}\right)\right) \]
      10. +-lowering-+.f6474.4

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{-2 \cdot C} \cdot \sqrt{\color{blue}{F + F}}\right)\right) \]
    9. Applied egg-rr74.4%

      \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \color{blue}{\left(\sqrt{-2 \cdot C} \cdot \sqrt{F + F}\right)}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification37.8%

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

Alternative 2: 52.6% accurate, 0.2× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := \left(4 \cdot A\right) \cdot C\\ t_2 := \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1 - {B}^{2}}\\ t_3 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\ t_4 := -0.25 \cdot \left(t\_3 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\ t_5 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;t\_2 \leq -4 \cdot 10^{-201}:\\ \;\;\;\;\frac{\sqrt{\left(\left(2 \cdot F\right) \cdot t\_5\right) \cdot \left(\left(A + C\right) - \sqrt{\mathsf{fma}\left(A - C, A - C, B \cdot B\right)}\right)}}{0 - t\_5}\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+226}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B \cdot B, \frac{-0.5}{C}, A + A\right) \cdot \left(t\_0 \cdot \left(2 \cdot F\right)\right)}}{0 - t\_0}\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;-0.25 \cdot \left(t\_3 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_4\\ \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 B B (* A (* C -4.0))))
        (t_1 (* (* 4.0 A) C))
        (t_2
         (/
          (sqrt
           (*
            (* 2.0 (* (- (pow B 2.0) t_1) F))
            (- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))))
          (- t_1 (pow B 2.0))))
        (t_3 (/ (* (sqrt 2.0) (sqrt 2.0)) C))
        (t_4 (* -0.25 (* t_3 (* (sqrt (* F -4.0)) (sqrt C)))))
        (t_5 (fma B B (* -4.0 (* A C)))))
   (if (<= t_2 (- INFINITY))
     t_4
     (if (<= t_2 -4e-201)
       (/
        (sqrt
         (*
          (* (* 2.0 F) t_5)
          (- (+ A C) (sqrt (fma (- A C) (- A C) (* B B))))))
        (- 0.0 t_5))
       (if (<= t_2 4e+226)
         (/
          (sqrt (* (fma (* B B) (/ -0.5 C) (+ A A)) (* t_0 (* 2.0 F))))
          (- 0.0 t_0))
         (if (<= t_2 INFINITY)
           (* -0.25 (* t_3 (* (sqrt (* C -2.0)) (sqrt (+ F F)))))
           t_4))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double t_0 = fma(B, B, (A * (C * -4.0)));
	double t_1 = (4.0 * A) * C;
	double t_2 = sqrt(((2.0 * ((pow(B, 2.0) - t_1) * F)) * ((A + C) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / (t_1 - pow(B, 2.0));
	double t_3 = (sqrt(2.0) * sqrt(2.0)) / C;
	double t_4 = -0.25 * (t_3 * (sqrt((F * -4.0)) * sqrt(C)));
	double t_5 = fma(B, B, (-4.0 * (A * C)));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_4;
	} else if (t_2 <= -4e-201) {
		tmp = sqrt((((2.0 * F) * t_5) * ((A + C) - sqrt(fma((A - C), (A - C), (B * B)))))) / (0.0 - t_5);
	} else if (t_2 <= 4e+226) {
		tmp = sqrt((fma((B * B), (-0.5 / C), (A + A)) * (t_0 * (2.0 * F)))) / (0.0 - t_0);
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = -0.25 * (t_3 * (sqrt((C * -2.0)) * sqrt((F + F))));
	} else {
		tmp = t_4;
	}
	return tmp;
}
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	t_0 = fma(B, B, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(Float64(4.0 * A) * C)
	t_2 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B ^ 2.0) - t_1) * F)) * Float64(Float64(A + C) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_1 - (B ^ 2.0)))
	t_3 = Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C)
	t_4 = Float64(-0.25 * Float64(t_3 * Float64(sqrt(Float64(F * -4.0)) * sqrt(C))))
	t_5 = fma(B, B, Float64(-4.0 * Float64(A * C)))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_4;
	elseif (t_2 <= -4e-201)
		tmp = Float64(sqrt(Float64(Float64(Float64(2.0 * F) * t_5) * Float64(Float64(A + C) - sqrt(fma(Float64(A - C), Float64(A - C), Float64(B * B)))))) / Float64(0.0 - t_5));
	elseif (t_2 <= 4e+226)
		tmp = Float64(sqrt(Float64(fma(Float64(B * B), Float64(-0.5 / C), Float64(A + A)) * Float64(t_0 * Float64(2.0 * F)))) / Float64(0.0 - t_0));
	elseif (t_2 <= Inf)
		tmp = Float64(-0.25 * Float64(t_3 * Float64(sqrt(Float64(C * -2.0)) * sqrt(Float64(F + F)))));
	else
		tmp = t_4;
	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[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]}, Block[{t$95$4 = N[(-0.25 * N[(t$95$3 * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$4, If[LessEqual[t$95$2, -4e-201], N[(N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$5), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[(A - C), $MachinePrecision] * N[(A - C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+226], N[(N[Sqrt[N[(N[(N[(B * B), $MachinePrecision] * N[(-0.5 / C), $MachinePrecision] + N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(-0.25 * N[(t$95$3 * N[(N[Sqrt[N[(C * -2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F + F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]]]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1 - {B}^{2}}\\
t_3 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\
t_4 := -0.25 \cdot \left(t\_3 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\
t_5 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{-201}:\\
\;\;\;\;\frac{\sqrt{\left(\left(2 \cdot F\right) \cdot t\_5\right) \cdot \left(\left(A + C\right) - \sqrt{\mathsf{fma}\left(A - C, A - C, B \cdot B\right)}\right)}}{0 - t\_5}\\

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

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;-0.25 \cdot \left(t\_3 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_4\\


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

    1. Initial program 1.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr0.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6413.0

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified13.0%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
      11. sqrt-lowering-sqrt.f6417.8

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
    9. Applied egg-rr17.8%

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

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

    1. Initial program 98.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. Add Preprocessing
    3. Step-by-step derivation
      1. distribute-frac-negN/A

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

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

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

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

    if -3.99999999999999978e-201 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < 3.99999999999999985e226

    1. Initial program 27.4%

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

      \[\leadsto \frac{\mathsf{neg}\left(\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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{\mathsf{neg}\left(\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(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} - -1 \cdot A\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\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(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, \frac{-1}{2}, A\right)\right)}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      12. *-lowering-*.f6433.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(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, -0.5, A\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Simplified33.6%

      \[\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 + \mathsf{fma}\left(\frac{B \cdot B}{C}, -0.5, A\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Step-by-step derivation
      1. distribute-frac-negN/A

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

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

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(A + \left(\frac{B \cdot B}{C} \cdot \frac{-1}{2} + A\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}}\right) \]
    7. Applied egg-rr33.6%

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

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

    1. Initial program 8.4%

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

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr0.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6469.9

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

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{-2 \cdot C} \cdot \color{blue}{\sqrt{F + F}}\right)\right) \]
      10. +-lowering-+.f6474.4

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{-2 \cdot C} \cdot \sqrt{\color{blue}{F + F}}\right)\right) \]
    9. Applied egg-rr74.4%

      \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \color{blue}{\left(\sqrt{-2 \cdot C} \cdot \sqrt{F + F}\right)}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification37.8%

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

Alternative 3: 45.4% accurate, 5.5× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} t_0 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\ \mathbf{if}\;C \leq -2.9 \cdot 10^{-230}:\\ \;\;\;\;-0.25 \cdot \left(t\_0 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\ \mathbf{elif}\;C \leq 5.8 \cdot 10^{-281}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\ \mathbf{else}:\\ \;\;\;\;-0.25 \cdot \left(t\_0 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\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 (/ (* (sqrt 2.0) (sqrt 2.0)) C)))
   (if (<= C -2.9e-230)
     (* -0.25 (* t_0 (* (sqrt (* C -2.0)) (sqrt (+ F F)))))
     (if (<= C 5.8e-281)
       (* (sqrt (* F (- A (sqrt (fma A A (* B B)))))) (/ (sqrt 2.0) (- 0.0 B)))
       (* -0.25 (* t_0 (* (sqrt (* F -4.0)) (sqrt C))))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double t_0 = (sqrt(2.0) * sqrt(2.0)) / C;
	double tmp;
	if (C <= -2.9e-230) {
		tmp = -0.25 * (t_0 * (sqrt((C * -2.0)) * sqrt((F + F))));
	} else if (C <= 5.8e-281) {
		tmp = sqrt((F * (A - sqrt(fma(A, A, (B * B)))))) * (sqrt(2.0) / (0.0 - B));
	} else {
		tmp = -0.25 * (t_0 * (sqrt((F * -4.0)) * sqrt(C)));
	}
	return tmp;
}
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	t_0 = Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C)
	tmp = 0.0
	if (C <= -2.9e-230)
		tmp = Float64(-0.25 * Float64(t_0 * Float64(sqrt(Float64(C * -2.0)) * sqrt(Float64(F + F)))));
	elseif (C <= 5.8e-281)
		tmp = Float64(sqrt(Float64(F * Float64(A - sqrt(fma(A, A, Float64(B * B)))))) * Float64(sqrt(2.0) / Float64(0.0 - B)));
	else
		tmp = Float64(-0.25 * Float64(t_0 * Float64(sqrt(Float64(F * -4.0)) * sqrt(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[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]}, If[LessEqual[C, -2.9e-230], N[(-0.25 * N[(t$95$0 * N[(N[Sqrt[N[(C * -2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F + F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 5.8e-281], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[N[(A * A + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(t$95$0 * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\
\mathbf{if}\;C \leq -2.9 \cdot 10^{-230}:\\
\;\;\;\;-0.25 \cdot \left(t\_0 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\

\mathbf{elif}\;C \leq 5.8 \cdot 10^{-281}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\

\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(t\_0 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\


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

    1. Initial program 24.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr7.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6413.6

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified13.6%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{-2 \cdot C} \cdot \color{blue}{\sqrt{F + F}}\right)\right) \]
      10. +-lowering-+.f6415.2

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{-2 \cdot C} \cdot \sqrt{\color{blue}{F + F}}\right)\right) \]
    9. Applied egg-rr15.2%

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

    if -2.90000000000000005e-230 < C < 5.7999999999999998e-281

    1. Initial program 28.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. Add Preprocessing
    3. Step-by-step derivation
      1. frac-2negN/A

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

        \[\leadsto \frac{\color{blue}{\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)}}}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)} \]
      3. pow1/2N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{-1} \cdot \frac{\sqrt{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right) \cdot \left(\left(A + C\right) - \sqrt{\mathsf{fma}\left(A - C, A - C, B \cdot B\right)}\right)}}{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\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{{A}^{2} + {B}^{2}}\right)}\right)} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, \color{blue}{B \cdot B}\right)}\right)}\right) \]
      13. *-lowering-*.f6411.6

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, \color{blue}{B \cdot B}\right)}\right)} \]
    7. Simplified11.6%

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

    if 5.7999999999999998e-281 < C

    1. Initial program 17.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr10.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6428.5

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified28.5%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
      11. sqrt-lowering-sqrt.f6436.9

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
    9. Applied egg-rr36.9%

      \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \color{blue}{\left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification24.7%

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

Alternative 4: 44.0% accurate, 5.5× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;C \leq -3.05 \cdot 10^{-235}:\\ \;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\ \mathbf{elif}\;C \leq 7 \cdot 10^{-281}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\ \mathbf{else}:\\ \;\;\;\;-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\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 (<= C -3.05e-235)
   (* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0)))))
   (if (<= C 7e-281)
     (* (sqrt (* F (- A (sqrt (fma A A (* B B)))))) (/ (sqrt 2.0) (- 0.0 B)))
     (*
      -0.25
      (* (/ (* (sqrt 2.0) (sqrt 2.0)) C) (* (sqrt (* F -4.0)) (sqrt C)))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double tmp;
	if (C <= -3.05e-235) {
		tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
	} else if (C <= 7e-281) {
		tmp = sqrt((F * (A - sqrt(fma(A, A, (B * B)))))) * (sqrt(2.0) / (0.0 - B));
	} else {
		tmp = -0.25 * (((sqrt(2.0) * sqrt(2.0)) / C) * (sqrt((F * -4.0)) * sqrt(C)));
	}
	return tmp;
}
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	tmp = 0.0
	if (C <= -3.05e-235)
		tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0)))));
	elseif (C <= 7e-281)
		tmp = Float64(sqrt(Float64(F * Float64(A - sqrt(fma(A, A, Float64(B * B)))))) * Float64(sqrt(2.0) / Float64(0.0 - B)));
	else
		tmp = Float64(-0.25 * Float64(Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C) * Float64(sqrt(Float64(F * -4.0)) * sqrt(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[C, -3.05e-235], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 7e-281], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[N[(A * A + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision] * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq -3.05 \cdot 10^{-235}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\

\mathbf{elif}\;C \leq 7 \cdot 10^{-281}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\

\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\


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

    1. Initial program 24.5%

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

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr6.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6414.1

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified14.1%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. rem-square-sqrt14.3

        \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    9. Applied egg-rr14.3%

      \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    10. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

        \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot \color{blue}{-4}\right)}\right) \]
    11. Applied egg-rr14.3%

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

    if -3.04999999999999994e-235 < C < 7.00000000000000044e-281

    1. Initial program 28.0%

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

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

        \[\leadsto \frac{\color{blue}{\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)}}}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)} \]
      3. pow1/2N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{-1} \cdot \frac{\sqrt{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right) \cdot \left(\left(A + C\right) - \sqrt{\mathsf{fma}\left(A - C, A - C, B \cdot B\right)}\right)}}{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\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{{A}^{2} + {B}^{2}}\right)}\right)} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, \color{blue}{B \cdot B}\right)}\right)}\right) \]
      13. *-lowering-*.f6412.7

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, \color{blue}{B \cdot B}\right)}\right)} \]
    7. Simplified12.7%

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

    if 7.00000000000000044e-281 < C

    1. Initial program 17.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr10.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6428.5

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified28.5%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
      11. sqrt-lowering-sqrt.f6436.9

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \color{blue}{\sqrt{C}}\right)\right) \]
    9. Applied egg-rr36.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq -3.05 \cdot 10^{-235}:\\ \;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\ \mathbf{elif}\;C \leq 7 \cdot 10^{-281}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\ \mathbf{else}:\\ \;\;\;\;-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 38.0% accurate, 6.1× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq -3.9 \cdot 10^{-79}:\\ \;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-144}:\\ \;\;\;\;\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(B, B, A \cdot A\right)}\right)}}{0 - B}\\ \mathbf{else}:\\ \;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\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 (<= F -3.9e-79)
   (* (sqrt (/ (* F -0.5) C)) (- 0.0 (sqrt 2.0)))
   (if (<= F -1.7e-144)
     (/ (* (sqrt 2.0) (sqrt (* F (- A (sqrt (fma B B (* A A))))))) (- 0.0 B))
     (* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0))))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double tmp;
	if (F <= -3.9e-79) {
		tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
	} else if (F <= -1.7e-144) {
		tmp = (sqrt(2.0) * sqrt((F * (A - sqrt(fma(B, B, (A * A))))))) / (0.0 - B);
	} else {
		tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
	}
	return tmp;
}
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	tmp = 0.0
	if (F <= -3.9e-79)
		tmp = Float64(sqrt(Float64(Float64(F * -0.5) / C)) * Float64(0.0 - sqrt(2.0)));
	elseif (F <= -1.7e-144)
		tmp = Float64(Float64(sqrt(2.0) * sqrt(Float64(F * Float64(A - sqrt(fma(B, B, Float64(A * A))))))) / Float64(0.0 - B));
	else
		tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.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_] := If[LessEqual[F, -3.9e-79], N[(N[Sqrt[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.7e-144], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F * N[(A - N[Sqrt[N[(B * B + N[(A * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{-79}:\\
\;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\

\mathbf{elif}\;F \leq -1.7 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(B, B, A \cdot A\right)}\right)}}{0 - B}\\

\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -3.90000000000000006e-79

    1. Initial program 13.5%

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

      \[\leadsto \frac{\mathsf{neg}\left(\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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{\mathsf{neg}\left(\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(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} - -1 \cdot A\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\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(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, \frac{-1}{2}, A\right)\right)}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      12. *-lowering-*.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(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, -0.5, A\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Simplified18.6%

      \[\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 + \mathsf{fma}\left(\frac{B \cdot B}{C}, -0.5, A\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in F around 0

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

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

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

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

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

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

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

        \[\leadsto \mathsf{neg}\left(\sqrt{\color{blue}{\frac{\frac{-1}{2} \cdot F}{C}}} \cdot \sqrt{2}\right) \]
      3. *-lowering-*.f6417.5

        \[\leadsto -\sqrt{\frac{\color{blue}{-0.5 \cdot F}}{C}} \cdot \sqrt{2} \]
    11. Simplified17.5%

      \[\leadsto -\sqrt{\color{blue}{\frac{-0.5 \cdot F}{C}}} \cdot \sqrt{2} \]

    if -3.90000000000000006e-79 < F < -1.70000000000000009e-144

    1. Initial program 41.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}{-1 \cdot B}} \]
    5. Simplified15.8%

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

    if -1.70000000000000009e-144 < F

    1. Initial program 26.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr10.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6430.8

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified30.8%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. rem-square-sqrt31.2

        \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    9. Applied egg-rr31.2%

      \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    10. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

        \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot \color{blue}{-4}\right)}\right) \]
    11. Applied egg-rr31.2%

      \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \color{blue}{\left(C \cdot -4\right)}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification22.8%

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

Alternative 6: 38.0% accurate, 6.1× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq -4.8 \cdot 10^{-79}:\\ \;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-144}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\ \mathbf{else}:\\ \;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\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 (<= F -4.8e-79)
   (* (sqrt (/ (* F -0.5) C)) (- 0.0 (sqrt 2.0)))
   (if (<= F -1.7e-144)
     (* (sqrt (* F (- A (sqrt (fma A A (* B B)))))) (/ (sqrt 2.0) (- 0.0 B)))
     (* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0))))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double tmp;
	if (F <= -4.8e-79) {
		tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
	} else if (F <= -1.7e-144) {
		tmp = sqrt((F * (A - sqrt(fma(A, A, (B * B)))))) * (sqrt(2.0) / (0.0 - B));
	} else {
		tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
	}
	return tmp;
}
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	tmp = 0.0
	if (F <= -4.8e-79)
		tmp = Float64(sqrt(Float64(Float64(F * -0.5) / C)) * Float64(0.0 - sqrt(2.0)));
	elseif (F <= -1.7e-144)
		tmp = Float64(sqrt(Float64(F * Float64(A - sqrt(fma(A, A, Float64(B * B)))))) * Float64(sqrt(2.0) / Float64(0.0 - B)));
	else
		tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.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_] := If[LessEqual[F, -4.8e-79], N[(N[Sqrt[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.7e-144], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[N[(A * A + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.8 \cdot 10^{-79}:\\
\;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\

\mathbf{elif}\;F \leq -1.7 \cdot 10^{-144}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\

\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -4.80000000000000011e-79

    1. Initial program 13.5%

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

      \[\leadsto \frac{\mathsf{neg}\left(\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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{\mathsf{neg}\left(\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(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} - -1 \cdot A\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\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(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, \frac{-1}{2}, A\right)\right)}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      12. *-lowering-*.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(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, -0.5, A\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Simplified18.6%

      \[\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 + \mathsf{fma}\left(\frac{B \cdot B}{C}, -0.5, A\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in F around 0

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

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

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

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

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

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

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

        \[\leadsto \mathsf{neg}\left(\sqrt{\color{blue}{\frac{\frac{-1}{2} \cdot F}{C}}} \cdot \sqrt{2}\right) \]
      3. *-lowering-*.f6417.5

        \[\leadsto -\sqrt{\frac{\color{blue}{-0.5 \cdot F}}{C}} \cdot \sqrt{2} \]
    11. Simplified17.5%

      \[\leadsto -\sqrt{\color{blue}{\frac{-0.5 \cdot F}{C}}} \cdot \sqrt{2} \]

    if -4.80000000000000011e-79 < F < -1.70000000000000009e-144

    1. Initial program 41.9%

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

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

        \[\leadsto \frac{\color{blue}{\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)}}}{\mathsf{neg}\left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)\right)} \]
      3. pow1/2N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{-1} \cdot \frac{\sqrt{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right) \cdot \left(\left(A + C\right) - \sqrt{\mathsf{fma}\left(A - C, A - C, B \cdot B\right)}\right)}}{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\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{{A}^{2} + {B}^{2}}\right)}\right)} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{neg}\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, \color{blue}{B \cdot B}\right)}\right)}\right) \]
      13. *-lowering-*.f6415.7

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, \color{blue}{B \cdot B}\right)}\right)} \]
    7. Simplified15.7%

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

    if -1.70000000000000009e-144 < F

    1. Initial program 26.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr10.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6430.8

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified30.8%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. rem-square-sqrt31.2

        \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    9. Applied egg-rr31.2%

      \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    10. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

        \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot \color{blue}{-4}\right)}\right) \]
    11. Applied egg-rr31.2%

      \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \color{blue}{\left(C \cdot -4\right)}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification22.8%

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

Alternative 7: 40.2% accurate, 9.6× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq -5.2 \cdot 10^{-122}:\\ \;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\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 (<= F -5.2e-122)
   (* (sqrt (/ (* F -0.5) C)) (- 0.0 (sqrt 2.0)))
   (* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0)))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	double tmp;
	if (F <= -5.2e-122) {
		tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
	} else {
		tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
	}
	return tmp;
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (f <= (-5.2d-122)) then
        tmp = sqrt(((f * (-0.5d0)) / c)) * (0.0d0 - sqrt(2.0d0))
    else
        tmp = (-0.25d0) * ((2.0d0 / c) * sqrt((f * (c * (-4.0d0)))))
    end if
    code = tmp
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
	double tmp;
	if (F <= -5.2e-122) {
		tmp = Math.sqrt(((F * -0.5) / C)) * (0.0 - Math.sqrt(2.0));
	} else {
		tmp = -0.25 * ((2.0 / C) * Math.sqrt((F * (C * -4.0))));
	}
	return tmp;
}
[A, B, C, F] = sort([A, B, C, F])
def code(A, B, C, F):
	tmp = 0
	if F <= -5.2e-122:
		tmp = math.sqrt(((F * -0.5) / C)) * (0.0 - math.sqrt(2.0))
	else:
		tmp = -0.25 * ((2.0 / C) * math.sqrt((F * (C * -4.0))))
	return tmp
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	tmp = 0.0
	if (F <= -5.2e-122)
		tmp = Float64(sqrt(Float64(Float64(F * -0.5) / C)) * Float64(0.0 - sqrt(2.0)));
	else
		tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0)))));
	end
	return tmp
end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp_2 = code(A, B, C, F)
	tmp = 0.0;
	if (F <= -5.2e-122)
		tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
	else
		tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
	end
	tmp_2 = 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[F, -5.2e-122], N[(N[Sqrt[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.2 \cdot 10^{-122}:\\
\;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\

\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -5.1999999999999995e-122

    1. Initial program 16.4%

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

      \[\leadsto \frac{\mathsf{neg}\left(\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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{\mathsf{neg}\left(\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(\frac{-1}{2} \cdot \frac{{B}^{2}}{C} - -1 \cdot A\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\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(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right)\right)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, \frac{-1}{2}, A\right)\right)}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      12. *-lowering-*.f6417.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(A + \mathsf{fma}\left(\frac{\color{blue}{B \cdot B}}{C}, -0.5, A\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Simplified17.6%

      \[\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 + \mathsf{fma}\left(\frac{B \cdot B}{C}, -0.5, A\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in F around 0

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

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

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

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

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

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

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

        \[\leadsto \mathsf{neg}\left(\sqrt{\color{blue}{\frac{\frac{-1}{2} \cdot F}{C}}} \cdot \sqrt{2}\right) \]
      3. *-lowering-*.f6416.7

        \[\leadsto -\sqrt{\frac{\color{blue}{-0.5 \cdot F}}{C}} \cdot \sqrt{2} \]
    11. Simplified16.7%

      \[\leadsto -\sqrt{\color{blue}{\frac{-0.5 \cdot F}{C}}} \cdot \sqrt{2} \]

    if -5.1999999999999995e-122 < F

    1. Initial program 28.5%

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

        \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. flip--N/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. sqrt-divN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr11.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
      10. cancel-sign-sub-invN/A

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

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

        \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
      13. *-lowering-*.f6428.7

        \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
    7. Simplified28.7%

      \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
    8. Step-by-step derivation
      1. rem-square-sqrt29.1

        \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    9. Applied egg-rr29.1%

      \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
    10. Step-by-step derivation
      1. distribute-rgt-outN/A

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

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

        \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot \color{blue}{-4}\right)}\right) \]
    11. Applied egg-rr29.1%

      \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \color{blue}{\left(C \cdot -4\right)}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.2%

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

Alternative 8: 36.6% accurate, 11.7× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\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 (* (/ 2.0 C) (sqrt (* F (* C -4.0))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	return -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = (-0.25d0) * ((2.0d0 / c) * sqrt((f * (c * (-4.0d0)))))
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
	return -0.25 * ((2.0 / C) * Math.sqrt((F * (C * -4.0))));
}
[A, B, C, F] = sort([A, B, C, F])
def code(A, B, C, F):
	return -0.25 * ((2.0 / C) * math.sqrt((F * (C * -4.0))))
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	return Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0)))))
end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp = code(A, B, C, F)
	tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
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[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)
\end{array}
Derivation
  1. Initial program 21.8%

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

      \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. flip--N/A

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

      \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. sqrt-divN/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. /-lowering-/.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  4. Applied egg-rr9.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
    10. cancel-sign-sub-invN/A

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

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

      \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
    13. *-lowering-*.f6420.7

      \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
  7. Simplified20.7%

    \[\leadsto \color{blue}{-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right)} \]
  8. Step-by-step derivation
    1. rem-square-sqrt21.0

      \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
  9. Applied egg-rr21.0%

    \[\leadsto -0.25 \cdot \left(\frac{\color{blue}{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, -2 \cdot C\right)}\right) \]
  10. Step-by-step derivation
    1. distribute-rgt-outN/A

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

      \[\leadsto \frac{-1}{4} \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \color{blue}{\left(C \cdot \left(-2 + -2\right)\right)}}\right) \]
    3. metadata-eval21.0

      \[\leadsto -0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot \color{blue}{-4}\right)}\right) \]
  11. Applied egg-rr21.0%

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

Alternative 9: 3.2% accurate, 14.0× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \frac{-0.5}{C} \cdot \sqrt{F \cdot \left(A + A\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.5 C) (sqrt (* F (+ A A)))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	return (-0.5 / C) * sqrt((F * (A + A)));
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = ((-0.5d0) / c) * sqrt((f * (a + a)))
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
	return (-0.5 / C) * Math.sqrt((F * (A + A)));
}
[A, B, C, F] = sort([A, B, C, F])
def code(A, B, C, F):
	return (-0.5 / C) * math.sqrt((F * (A + A)))
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	return Float64(Float64(-0.5 / C) * sqrt(Float64(F * Float64(A + A))))
end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp = code(A, B, C, F)
	tmp = (-0.5 / C) * sqrt((F * (A + A)));
end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := N[(N[(-0.5 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\frac{-0.5}{C} \cdot \sqrt{F \cdot \left(A + A\right)}
\end{array}
Derivation
  1. Initial program 21.8%

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

      \[\leadsto \frac{\mathsf{neg}\left(\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)}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. flip--N/A

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

      \[\leadsto \frac{\mathsf{neg}\left(\sqrt{\color{blue}{\frac{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. sqrt-divN/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. /-lowering-/.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{\sqrt{\left(\left(A + C\right) \cdot \left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \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)}}{\sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  4. Applied egg-rr9.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(-2 \cdot C - 2 \cdot C\right)}}\right) \]
    10. cancel-sign-sub-invN/A

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

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

      \[\leadsto \frac{-1}{4} \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \color{blue}{\mathsf{fma}\left(-2, C, -2 \cdot C\right)}}\right) \]
    13. *-lowering-*.f6420.7

      \[\leadsto -0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \sqrt{F \cdot \mathsf{fma}\left(-2, C, \color{blue}{-2 \cdot C}\right)}\right) \]
  7. Simplified20.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{-1}{2}}{C} \cdot \sqrt{\frac{\color{blue}{0}}{0} \cdot F} \]
    11. +-inversesN/A

      \[\leadsto \frac{\frac{-1}{2}}{C} \cdot \sqrt{\frac{\color{blue}{A \cdot A - A \cdot A}}{0} \cdot F} \]
    12. +-inversesN/A

      \[\leadsto \frac{\frac{-1}{2}}{C} \cdot \sqrt{\frac{A \cdot A - A \cdot A}{\color{blue}{A - A}} \cdot F} \]
    13. flip-+N/A

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

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

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

      \[\leadsto \frac{\frac{-1}{2}}{C} \cdot \sqrt{\color{blue}{F \cdot \left(A + A\right)}} \]
    17. +-lowering-+.f641.8

      \[\leadsto \frac{-0.5}{C} \cdot \sqrt{F \cdot \color{blue}{\left(A + A\right)}} \]
  9. Applied egg-rr1.8%

    \[\leadsto \color{blue}{\frac{-0.5}{C} \cdot \sqrt{F \cdot \left(A + A\right)}} \]
  10. Add Preprocessing

Alternative 10: 1.9% accurate, 18.2× speedup?

\[\begin{array}{l} [A, B, C, F] = \mathsf{sort}([A, B, C, F])\\ \\ \sqrt{\frac{2 \cdot F}{B}} \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 (/ (* 2.0 F) B)))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
	return sqrt(((2.0 * F) / B));
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = sqrt(((2.0d0 * f) / b))
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
	return Math.sqrt(((2.0 * F) / B));
}
[A, B, C, F] = sort([A, B, C, F])
def code(A, B, C, F):
	return math.sqrt(((2.0 * F) / B))
A, B, C, F = sort([A, B, C, F])
function code(A, B, C, F)
	return sqrt(Float64(Float64(2.0 * F) / B))
end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp = code(A, B, C, F)
	tmp = sqrt(((2.0 * F) / B));
end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\sqrt{\frac{2 \cdot F}{B}}
\end{array}
Derivation
  1. Initial program 21.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{F}{B}} \cdot \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \sqrt{2}}\right)\right) \]
    10. sqrt-lowering-sqrt.f641.9

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

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

      \[\leadsto \sqrt{\frac{F}{B}} \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\sqrt{2}\right)\right)}\right)\right) \]
    2. remove-double-negN/A

      \[\leadsto \sqrt{\frac{F}{B}} \cdot \color{blue}{\sqrt{2}} \]
    3. sqrt-lowering-sqrt.f641.9

      \[\leadsto \sqrt{\frac{F}{B}} \cdot \color{blue}{\sqrt{2}} \]
  7. Applied egg-rr1.9%

    \[\leadsto \sqrt{\frac{F}{B}} \cdot \color{blue}{\sqrt{2}} \]
  8. Step-by-step derivation
    1. sqrt-unprodN/A

      \[\leadsto \color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    3. associate-*l/N/A

      \[\leadsto \sqrt{\color{blue}{\frac{F \cdot 2}{B}}} \]
    4. /-lowering-/.f64N/A

      \[\leadsto \sqrt{\color{blue}{\frac{F \cdot 2}{B}}} \]
    5. *-commutativeN/A

      \[\leadsto \sqrt{\frac{\color{blue}{2 \cdot F}}{B}} \]
    6. *-lowering-*.f641.9

      \[\leadsto \sqrt{\frac{\color{blue}{2 \cdot F}}{B}} \]
  9. Applied egg-rr1.9%

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

Reproduce

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