ABCF->ab-angle b

Percentage Accurate: 19.0% → 53.7%
Time: 34.1s
Alternatives: 13
Speedup: 2.0×

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 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 19.0% 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: 53.7% accurate, 0.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_2 := \frac{-\sqrt{\left(2 \cdot \left(t\_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1}\\ t_3 := {B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{F \cdot \left(A + A\right)}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\ \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-187}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0}\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+162}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t\_3\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B\_m}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)}}{t\_3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B\_m, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
        (t_1 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_2
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_1 F))
             (- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
          t_1))
        (t_3 (- (pow B_m 2.0) (* 4.0 (* A C)))))
   (if (<= t_2 (- INFINITY))
     (-
      0.0
      (*
       (pow 1.0 0.3333333333333333)
       (*
        (pow
         (exp
          (*
           0.16666666666666666
           (+ (log (/ 1.0 C)) (log (* -0.25 (/ (* F (+ A A)) A))))))
         3.0)
        (sqrt 2.0))))
     (if (<= t_2 -1e-187)
       (/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (- C (hypot B_m (- A C)))))))) t_0)
       (if (<= t_2 2e+162)
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* F t_3))
             (+
              A
              (+
               A
               (*
                -0.5
                (/ (+ (pow A 2.0) (- (pow B_m 2.0) (pow (- A) 2.0))) C)))))))
          t_3)
         (*
          (/ (sqrt 2.0) B_m)
          (-
           (exp (* (- (log (- (hypot B_m A) A)) (log (/ -1.0 F))) 0.5)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = pow(B_m, 2.0) - ((4.0 * A) * C);
	double t_2 = -sqrt(((2.0 * (t_1 * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_1;
	double t_3 = pow(B_m, 2.0) - (4.0 * (A * C));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = 0.0 - (pow(1.0, 0.3333333333333333) * (pow(exp((0.16666666666666666 * (log((1.0 / C)) + log((-0.25 * ((F * (A + A)) / A)))))), 3.0) * sqrt(2.0)));
	} else if (t_2 <= -1e-187) {
		tmp = -sqrt(((F * t_0) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_0;
	} else if (t_2 <= 2e+162) {
		tmp = -sqrt(((2.0 * (F * t_3)) * (A + (A + (-0.5 * ((pow(A, 2.0) + (pow(B_m, 2.0) - pow(-A, 2.0))) / C)))))) / t_3;
	} else {
		tmp = (sqrt(2.0) / B_m) * -exp(((log((hypot(B_m, A) - A)) - log((-1.0 / F))) * 0.5));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_2 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_1)
	t_3 = Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C)))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(0.0 - Float64((1.0 ^ 0.3333333333333333) * Float64((exp(Float64(0.16666666666666666 * Float64(log(Float64(1.0 / C)) + log(Float64(-0.25 * Float64(Float64(F * Float64(A + A)) / A)))))) ^ 3.0) * sqrt(2.0))));
	elseif (t_2 <= -1e-187)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_0);
	elseif (t_2 <= 2e+162)
		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_3)) * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64((A ^ 2.0) + Float64((B_m ^ 2.0) - (Float64(-A) ^ 2.0))) / C))))))) / t_3);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(Float64(log(Float64(hypot(B_m, A) - A)) - log(Float64(-1.0 / F))) * 0.5))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(0.0 - N[(N[Power[1.0, 0.3333333333333333], $MachinePrecision] * N[(N[Power[N[Exp[N[(0.16666666666666666 * N[(N[Log[N[(1.0 / C), $MachinePrecision]], $MachinePrecision] + N[Log[N[(-0.25 * N[(N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-187], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$2, 2e+162], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[(N[Power[A, 2.0], $MachinePrecision] + N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[Power[(-A), 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(N[(N[Log[N[(N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision] - A), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t\_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1}\\
t_3 := {B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{F \cdot \left(A + A\right)}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\

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

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

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


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

    1. Initial program 3.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. Simplified15.5%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-cube-cbrt15.4%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left({1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{F \cdot \left(A - -1 \cdot A\right)}{A}\right) + \log \left(\frac{1}{C}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\right)} \]

    if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -1e-187

    1. Initial program 97.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. Simplified97.9%

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

    if -1e-187 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.9999999999999999e162

    1. Initial program 15.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. Simplified18.5%

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

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right)\right) \cdot \left(A + \color{blue}{\left(A + -0.5 \cdot \frac{\left({A}^{2} + {B}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)}\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)} \]
    5. Step-by-step derivation
      1. associate--l+31.7%

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\color{blue}{{A}^{2} + \left({B}^{2} - {\left(-1 \cdot A\right)}^{2}\right)}}{C}\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)} \]
      2. mul-1-neg31.7%

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

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

    if 1.9999999999999999e162 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)))

    1. Initial program 0.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified1.5%

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

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

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. distribute-rgt-neg-in2.0%

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      3. *-commutative2.0%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}}\right) \]
      4. unpow22.0%

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def18.2%

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)} \]
    7. Step-by-step derivation
      1. pow1/218.2%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}^{0.5}}\right) \]
      2. pow-to-exp17.3%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{e^{\log \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right) \cdot 0.5}}\right) \]
    8. Applied egg-rr17.3%

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

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + -1 \cdot \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
    10. Step-by-step derivation
      1. mul-1-neg1.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + \color{blue}{\left(-\log \left(\frac{-1}{F}\right)\right)}\right) \cdot 0.5}\right) \]
      2. unsub-neg1.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
      3. mul-1-neg1.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \color{blue}{\left(-\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)} - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      4. +-commutative1.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      5. unpow21.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      6. unpow21.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      7. hypot-def26.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
    11. Simplified26.4%

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

    \[\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -\infty:\\ \;\;\;\;0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{F \cdot \left(A + A\right)}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -1 \cdot 10^{-187}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 2 \cdot 10^{+162}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 51.8% accurate, 0.6× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := F \cdot \left(A + A\right)\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_2 := 0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{t\_0}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\ \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot t\_0\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\ \mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-7}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+84}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_1}\\ \mathbf{elif}\;{B\_m}^{2} \leq 10^{+186}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B\_m, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* F (+ A A)))
        (t_1 (fma B_m B_m (* A (* C -4.0))))
        (t_2
         (-
          0.0
          (*
           (pow 1.0 0.3333333333333333)
           (*
            (pow
             (exp
              (*
               0.16666666666666666
               (+ (log (/ 1.0 C)) (log (* -0.25 (/ t_0 A))))))
             3.0)
            (sqrt 2.0))))))
   (if (<= (pow B_m 2.0) 5e-68)
     (/ (- (sqrt (* -8.0 (* (* A C) t_0)))) (fma A (* C -4.0) (pow B_m 2.0)))
     (if (<= (pow B_m 2.0) 2e-7)
       t_2
       (if (<= (pow B_m 2.0) 2e+84)
         (/
          (- (sqrt (* (* F t_1) (* 2.0 (+ A (- C (hypot B_m (- A C))))))))
          t_1)
         (if (<= (pow B_m 2.0) 1e+186)
           t_2
           (*
            (/ (sqrt 2.0) B_m)
            (-
             (exp
              (* (- (log (- (hypot B_m A) A)) (log (/ -1.0 F))) 0.5))))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = F * (A + A);
	double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_2 = 0.0 - (pow(1.0, 0.3333333333333333) * (pow(exp((0.16666666666666666 * (log((1.0 / C)) + log((-0.25 * (t_0 / A)))))), 3.0) * sqrt(2.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 5e-68) {
		tmp = -sqrt((-8.0 * ((A * C) * t_0))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	} else if (pow(B_m, 2.0) <= 2e-7) {
		tmp = t_2;
	} else if (pow(B_m, 2.0) <= 2e+84) {
		tmp = -sqrt(((F * t_1) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_1;
	} else if (pow(B_m, 2.0) <= 1e+186) {
		tmp = t_2;
	} else {
		tmp = (sqrt(2.0) / B_m) * -exp(((log((hypot(B_m, A) - A)) - log((-1.0 / F))) * 0.5));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(F * Float64(A + A))
	t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_2 = Float64(0.0 - Float64((1.0 ^ 0.3333333333333333) * Float64((exp(Float64(0.16666666666666666 * Float64(log(Float64(1.0 / C)) + log(Float64(-0.25 * Float64(t_0 / A)))))) ^ 3.0) * sqrt(2.0))))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e-68)
		tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * t_0)))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)));
	elseif ((B_m ^ 2.0) <= 2e-7)
		tmp = t_2;
	elseif ((B_m ^ 2.0) <= 2e+84)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_1);
	elseif ((B_m ^ 2.0) <= 1e+186)
		tmp = t_2;
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(Float64(log(Float64(hypot(B_m, A) - A)) - log(Float64(-1.0 / F))) * 0.5))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.0 - N[(N[Power[1.0, 0.3333333333333333], $MachinePrecision] * N[(N[Power[N[Exp[N[(0.16666666666666666 * N[(N[Log[N[(1.0 / C), $MachinePrecision]], $MachinePrecision] + N[Log[N[(-0.25 * N[(t$95$0 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-68], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-7], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+84], N[((-N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+186], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(N[(N[Log[N[(N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision] - A), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(A + A\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := 0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{t\_0}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot t\_0\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\

\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+84}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_1}\\

\mathbf{elif}\;{B\_m}^{2} \leq 10^{+186}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (pow.f64 B 2) < 4.99999999999999971e-68

    1. Initial program 15.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified20.2%

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

      \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*17.1%

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

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

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

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

    if 4.99999999999999971e-68 < (pow.f64 B 2) < 1.9999999999999999e-7 or 2.00000000000000012e84 < (pow.f64 B 2) < 9.9999999999999998e185

    1. Initial program 23.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. Simplified24.6%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-cube-cbrt24.1%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left({1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{F \cdot \left(A - -1 \cdot A\right)}{A}\right) + \log \left(\frac{1}{C}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\right)} \]

    if 1.9999999999999999e-7 < (pow.f64 B 2) < 2.00000000000000012e84

    1. Initial program 43.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. Simplified50.7%

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

    if 9.9999999999999998e185 < (pow.f64 B 2)

    1. Initial program 8.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified1.0%

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

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

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. distribute-rgt-neg-in9.8%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def30.7%

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)} \]
    7. Step-by-step derivation
      1. pow1/230.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}^{0.5}}\right) \]
      2. pow-to-exp28.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{e^{\log \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right) \cdot 0.5}}\right) \]
    8. Applied egg-rr28.9%

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

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + -1 \cdot \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
    10. Step-by-step derivation
      1. mul-1-neg12.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + \color{blue}{\left(-\log \left(\frac{-1}{F}\right)\right)}\right) \cdot 0.5}\right) \]
      2. unsub-neg12.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
      3. mul-1-neg12.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \color{blue}{\left(-\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)} - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      4. +-commutative12.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      5. unpow212.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      6. unpow212.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      7. hypot-def44.2%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
    11. Simplified44.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-68}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-7}:\\ \;\;\;\;0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{F \cdot \left(A + A\right)}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\ \mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{+84}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;{B}^{2} \leq 10^{+186}:\\ \;\;\;\;0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{F \cdot \left(A + A\right)}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 53.5% accurate, 0.8× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := F \cdot \left(A + A\right)\\ \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot t\_1\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\ \mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-7}:\\ \;\;\;\;{\left({\left(e^{0.16666666666666666}\right)}^{\left(\log \left(-0.25 \cdot \frac{t\_1}{A}\right) - \log C\right)}\right)}^{3} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+168}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B\_m, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))) (t_1 (* F (+ A A))))
   (if (<= (pow B_m 2.0) 5e-68)
     (/ (- (sqrt (* -8.0 (* (* A C) t_1)))) (fma A (* C -4.0) (pow B_m 2.0)))
     (if (<= (pow B_m 2.0) 2e-7)
       (*
        (pow
         (pow (exp 0.16666666666666666) (- (log (* -0.25 (/ t_1 A))) (log C)))
         3.0)
        (- (sqrt 2.0)))
       (if (<= (pow B_m 2.0) 5e+168)
         (/
          (- (sqrt (* (* F t_0) (* 2.0 (+ A (- C (hypot B_m (- A C))))))))
          t_0)
         (*
          (/ (sqrt 2.0) B_m)
          (-
           (exp (* (- (log (- (hypot B_m A) A)) (log (/ -1.0 F))) 0.5)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = F * (A + A);
	double tmp;
	if (pow(B_m, 2.0) <= 5e-68) {
		tmp = -sqrt((-8.0 * ((A * C) * t_1))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	} else if (pow(B_m, 2.0) <= 2e-7) {
		tmp = pow(pow(exp(0.16666666666666666), (log((-0.25 * (t_1 / A))) - log(C))), 3.0) * -sqrt(2.0);
	} else if (pow(B_m, 2.0) <= 5e+168) {
		tmp = -sqrt(((F * t_0) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_0;
	} else {
		tmp = (sqrt(2.0) / B_m) * -exp(((log((hypot(B_m, A) - A)) - log((-1.0 / F))) * 0.5));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(F * Float64(A + A))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e-68)
		tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * t_1)))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)));
	elseif ((B_m ^ 2.0) <= 2e-7)
		tmp = Float64(((exp(0.16666666666666666) ^ Float64(log(Float64(-0.25 * Float64(t_1 / A))) - log(C))) ^ 3.0) * Float64(-sqrt(2.0)));
	elseif ((B_m ^ 2.0) <= 5e+168)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_0);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(Float64(log(Float64(hypot(B_m, A) - A)) - log(Float64(-1.0 / F))) * 0.5))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-68], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-7], N[(N[Power[N[Power[N[Exp[0.16666666666666666], $MachinePrecision], N[(N[Log[N[(-0.25 * N[(t$95$1 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Log[C], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+168], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(N[(N[Log[N[(N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision] - A), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := F \cdot \left(A + A\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot t\_1\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\

\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;{\left({\left(e^{0.16666666666666666}\right)}^{\left(\log \left(-0.25 \cdot \frac{t\_1}{A}\right) - \log C\right)}\right)}^{3} \cdot \left(-\sqrt{2}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (pow.f64 B 2) < 4.99999999999999971e-68

    1. Initial program 15.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified20.2%

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

      \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*17.1%

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

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

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

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

    if 4.99999999999999971e-68 < (pow.f64 B 2) < 1.9999999999999999e-7

    1. Initial program 17.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified18.9%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-cube-cbrt18.6%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left({1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{F \cdot \left(A - -1 \cdot A\right)}{A}\right) + \log \left(\frac{1}{C}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-130.8%

        \[\leadsto -1 \cdot \left(\color{blue}{1} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{F \cdot \left(A - -1 \cdot A\right)}{A}\right) + \log \left(\frac{1}{C}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\right) \]
      2. associate-*r*30.8%

        \[\leadsto \color{blue}{\left(-1 \cdot 1\right) \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{F \cdot \left(A - -1 \cdot A\right)}{A}\right) + \log \left(\frac{1}{C}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)} \]
      3. metadata-eval30.8%

        \[\leadsto \color{blue}{-1} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{F \cdot \left(A - -1 \cdot A\right)}{A}\right) + \log \left(\frac{1}{C}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right) \]
    8. Simplified29.8%

      \[\leadsto \color{blue}{-1 \cdot \left({\left({\left(e^{0.16666666666666666}\right)}^{\left(\log \left(-0.25 \cdot \frac{F \cdot \left(A - \left(-A\right)\right)}{A}\right) + \left(-\log C\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)} \]

    if 1.9999999999999999e-7 < (pow.f64 B 2) < 4.99999999999999967e168

    1. Initial program 38.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified43.3%

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

    if 4.99999999999999967e168 < (pow.f64 B 2)

    1. Initial program 8.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. Simplified2.2%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      3. *-commutative9.3%

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

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def28.9%

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)} \]
    7. Step-by-step derivation
      1. pow1/228.9%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}^{0.5}}\right) \]
      2. pow-to-exp27.2%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{e^{\log \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right) \cdot 0.5}}\right) \]
    8. Applied egg-rr27.2%

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

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + -1 \cdot \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
    10. Step-by-step derivation
      1. mul-1-neg11.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + \color{blue}{\left(-\log \left(\frac{-1}{F}\right)\right)}\right) \cdot 0.5}\right) \]
      2. unsub-neg11.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
      3. mul-1-neg11.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \color{blue}{\left(-\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)} - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      4. +-commutative11.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      5. unpow211.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      6. unpow211.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      7. hypot-def41.5%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
    11. Simplified41.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-68}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-7}:\\ \;\;\;\;{\left({\left(e^{0.16666666666666666}\right)}^{\left(\log \left(-0.25 \cdot \frac{F \cdot \left(A + A\right)}{A}\right) - \log C\right)}\right)}^{3} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{+168}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 53.4% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 5e19

    1. Initial program 15.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. Simplified20.5%

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

      \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*16.1%

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

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

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

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

    if 5e19 < (pow.f64 B 2)

    1. Initial program 16.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. Simplified12.1%

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

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

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. distribute-rgt-neg-in9.4%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def24.1%

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)} \]
    7. Step-by-step derivation
      1. pow1/224.1%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}^{0.5}}\right) \]
      2. pow-to-exp22.7%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{e^{\log \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right) \cdot 0.5}}\right) \]
    8. Applied egg-rr22.7%

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

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + -1 \cdot \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
    10. Step-by-step derivation
      1. mul-1-neg11.1%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) + \color{blue}{\left(-\log \left(\frac{-1}{F}\right)\right)}\right) \cdot 0.5}\right) \]
      2. unsub-neg11.1%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\color{blue}{\left(\log \left(-1 \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right)} \cdot 0.5}\right) \]
      3. mul-1-neg11.1%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \color{blue}{\left(-\left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)} - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      4. +-commutative11.1%

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      6. unpow211.1%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
      7. hypot-def33.4%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-e^{\left(\log \left(-\left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right) \]
    11. Simplified33.4%

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

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

Alternative 5: 50.4% accurate, 1.5× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \frac{\sqrt{2}}{B\_m}\\ \mathbf{if}\;B\_m \leq 3.5 \cdot 10^{-32}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\ \mathbf{elif}\;B\_m \leq 2.15 \cdot 10^{+197}:\\ \;\;\;\;t\_0 \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(-e^{0.5 \cdot \left(\log \left(-F\right) - \log \left(\frac{1}{B\_m}\right)\right)}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (/ (sqrt 2.0) B_m)))
   (if (<= B_m 3.5e-32)
     (/
      (- (sqrt (* -8.0 (* (* A C) (* F (+ A A))))))
      (fma A (* C -4.0) (pow B_m 2.0)))
     (if (<= B_m 2.15e+197)
       (* t_0 (- (sqrt (* F (- A (hypot A B_m))))))
       (* t_0 (- (exp (* 0.5 (- (log (- F)) (log (/ 1.0 B_m)))))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = sqrt(2.0) / B_m;
	double tmp;
	if (B_m <= 3.5e-32) {
		tmp = -sqrt((-8.0 * ((A * C) * (F * (A + A))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	} else if (B_m <= 2.15e+197) {
		tmp = t_0 * -sqrt((F * (A - hypot(A, B_m))));
	} else {
		tmp = t_0 * -exp((0.5 * (log(-F) - log((1.0 / B_m)))));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(sqrt(2.0) / B_m)
	tmp = 0.0
	if (B_m <= 3.5e-32)
		tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A)))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)));
	elseif (B_m <= 2.15e+197)
		tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m))))));
	else
		tmp = Float64(t_0 * Float64(-exp(Float64(0.5 * Float64(log(Float64(-F)) - log(Float64(1.0 / B_m)))))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[B$95$m, 3.5e-32], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.15e+197], N[(t$95$0 * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * (-N[Exp[N[(0.5 * N[(N[Log[(-F)], $MachinePrecision] - N[Log[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B\_m}\\
\mathbf{if}\;B\_m \leq 3.5 \cdot 10^{-32}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\

\mathbf{elif}\;B\_m \leq 2.15 \cdot 10^{+197}:\\
\;\;\;\;t\_0 \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(-e^{0.5 \cdot \left(\log \left(-F\right) - \log \left(\frac{1}{B\_m}\right)\right)}\right)\\


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

    1. Initial program 17.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. Simplified19.9%

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

      \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*13.2%

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

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

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

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

    if 3.4999999999999999e-32 < B < 2.14999999999999998e197

    1. Initial program 19.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. Simplified13.1%

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

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

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. distribute-rgt-neg-in26.0%

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      3. *-commutative26.0%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}}\right) \]
      4. unpow226.0%

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def34.2%

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

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

    if 2.14999999999999998e197 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified0.0%

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

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

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. distribute-rgt-neg-in2.4%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def53.1%

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)} \]
    7. Step-by-step derivation
      1. pow1/253.1%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}^{0.5}}\right) \]
      2. pow-to-exp50.2%

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{e^{\log \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F\right) \cdot 0.5}}\right) \]
    8. Applied egg-rr50.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 3.5 \cdot 10^{-32}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 2.15 \cdot 10^{+197}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-e^{0.5 \cdot \left(\log \left(-F\right) - \log \left(\frac{1}{B}\right)\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 45.8% accurate, 2.0× speedup?

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

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


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

    1. Initial program 17.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. Simplified19.9%

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

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

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \color{blue}{\left(\left(A - -1 \cdot A\right) \cdot F\right)}\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \]
      2. cancel-sign-sub-inv12.6%

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

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

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

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

    if 2.15000000000000015e-33 < B

    1. Initial program 13.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. Simplified8.7%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def40.5%

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)}{B}} \]
    8. Applied egg-rr40.5%

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

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

Alternative 7: 46.4% accurate, 2.0× speedup?

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

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


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

    1. Initial program 17.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. Simplified19.9%

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

      \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*13.2%

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

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

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

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

    if 6.0000000000000003e-33 < B

    1. Initial program 13.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. Simplified8.7%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def40.5%

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)}{B}} \]
    8. Applied egg-rr40.5%

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

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

Alternative 8: 40.1% accurate, 2.0× speedup?

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

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


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

    1. Initial program 17.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. Simplified18.4%

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

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

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

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

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

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

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

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

    if 3.20000000000000027e-85 < B

    1. Initial program 13.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. Simplified13.8%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      3. *-commutative18.3%

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

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

        \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
      6. hypot-def38.4%

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)}{B}} \]
    8. Applied egg-rr38.5%

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

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

Alternative 9: 26.5% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)}\right) \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- C (hypot B_m C)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (sqrt(2.0) / B_m) * -sqrt((F * (C - hypot(B_m, C))));
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (C - Math.hypot(B_m, C))));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (math.sqrt(2.0) / B_m) * -math.sqrt((F * (C - math.hypot(B_m, C))))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C - hypot(B_m, C))))))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C - hypot(B_m, C))));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)}\right)
\end{array}
Derivation
  1. Initial program 16.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. Simplified16.6%

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

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg8.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    2. *-commutative8.6%

      \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C - \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
    3. distribute-rgt-neg-in8.6%

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

      \[\leadsto \sqrt{\color{blue}{\left(C - \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    5. unpow28.6%

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

      \[\leadsto \sqrt{\left(C - \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right) \cdot F} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    7. hypot-def16.1%

      \[\leadsto \sqrt{\left(C - \color{blue}{\mathsf{hypot}\left(B, C\right)}\right) \cdot F} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
  6. Simplified16.1%

    \[\leadsto \color{blue}{\sqrt{\left(C - \mathsf{hypot}\left(B, C\right)\right) \cdot F} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
  7. Final simplification16.1%

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C - \mathsf{hypot}\left(B, C\right)\right)}\right) \]
  8. Add Preprocessing

Alternative 10: 31.7% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right) \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot A B_m)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(A, B_m))));
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - Math.hypot(A, B_m))));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - math.hypot(A, B_m))))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m))))))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(A, B_m))));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)
\end{array}
Derivation
  1. Initial program 16.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. Simplified16.6%

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

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

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. distribute-rgt-neg-in7.7%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    3. *-commutative7.7%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}}\right) \]
    4. unpow27.7%

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

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
    6. hypot-def15.1%

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

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

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right) \]
  8. Add Preprocessing

Alternative 11: 31.8% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)}{B\_m} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (/ (* (sqrt 2.0) (- (sqrt (* F (- A (hypot A B_m)))))) B_m))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (sqrt(2.0) * -sqrt((F * (A - hypot(A, B_m))))) / B_m;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return (Math.sqrt(2.0) * -Math.sqrt((F * (A - Math.hypot(A, B_m))))) / B_m;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (math.sqrt(2.0) * -math.sqrt((F * (A - math.hypot(A, B_m))))) / B_m
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m)))))) / B_m)
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (sqrt(2.0) * -sqrt((F * (A - hypot(A, B_m))))) / B_m;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B$95$m), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)}{B\_m}
\end{array}
Derivation
  1. Initial program 16.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. Simplified16.6%

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

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

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. distribute-rgt-neg-in7.7%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    3. *-commutative7.7%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\color{blue}{\left(A - \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}}\right) \]
    4. unpow27.7%

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

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right) \cdot F}\right) \]
    6. hypot-def15.1%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)}{B}} \]
  8. Applied egg-rr15.1%

    \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot \left(-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot F}\right)}{B}} \]
  9. Final simplification15.1%

    \[\leadsto \frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right)}{B} \]
  10. Add Preprocessing

Alternative 12: 1.2% accurate, 5.8× speedup?

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

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

    \[\leadsto \frac{-\sqrt{F \cdot \left(\color{blue}{\left(C - -1 \cdot C\right)} \cdot \left(2 \cdot \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \]
  5. Step-by-step derivation
    1. cancel-sign-sub-inv14.6%

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

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

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

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

    \[\leadsto \color{blue}{-2 \cdot \left(\frac{1}{B} \cdot \sqrt{C \cdot F}\right)} \]
  8. Step-by-step derivation
    1. pow1/23.2%

      \[\leadsto -2 \cdot \left(\frac{1}{B} \cdot \color{blue}{{\left(C \cdot F\right)}^{0.5}}\right) \]
    2. *-commutative3.2%

      \[\leadsto -2 \cdot \left(\frac{1}{B} \cdot {\color{blue}{\left(F \cdot C\right)}}^{0.5}\right) \]
  9. Applied egg-rr3.2%

    \[\leadsto -2 \cdot \left(\frac{1}{B} \cdot \color{blue}{{\left(F \cdot C\right)}^{0.5}}\right) \]
  10. Final simplification3.2%

    \[\leadsto -2 \cdot \left(\frac{1}{B} \cdot {\left(C \cdot F\right)}^{0.5}\right) \]
  11. Add Preprocessing

Alternative 13: 1.0% accurate, 5.9× speedup?

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

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

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

    \[\leadsto \color{blue}{-2 \cdot \left(\frac{1}{B} \cdot \sqrt{C \cdot F}\right)} \]
  6. Step-by-step derivation
    1. associate-*l/3.1%

      \[\leadsto -2 \cdot \color{blue}{\frac{1 \cdot \sqrt{C \cdot F}}{B}} \]
    2. *-commutative3.1%

      \[\leadsto -2 \cdot \frac{1 \cdot \sqrt{\color{blue}{F \cdot C}}}{B} \]
    3. *-lft-identity3.1%

      \[\leadsto -2 \cdot \frac{\color{blue}{\sqrt{F \cdot C}}}{B} \]
  7. Simplified3.1%

    \[\leadsto \color{blue}{-2 \cdot \frac{\sqrt{F \cdot C}}{B}} \]
  8. Final simplification3.1%

    \[\leadsto -2 \cdot \frac{\sqrt{C \cdot F}}{B} \]
  9. Add Preprocessing

Reproduce

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