ABCF->ab-angle b

Percentage Accurate: 18.7% → 44.8%
Time: 30.0s
Alternatives: 11
Speedup: 3.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 11 alternatives:

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

Initial Program: 18.7% 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: 44.8% 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} t_0 := \frac{-\sqrt{2}}{B_m}\\ t_1 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\ \mathbf{if}\;{B_m}^{2} \leq 4 \cdot 10^{+123}:\\ \;\;\;\;\frac{1}{\frac{t_1}{-\sqrt{t_1 \cdot \left(F \cdot \left(2 \cdot \left(2 \cdot A\right)\right)\right)}}}\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\ \;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\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)) (t_1 (fma A (* C -4.0) (pow B_m 2.0))))
   (if (<= (pow B_m 2.0) 4e+123)
     (/ 1.0 (/ t_1 (- (sqrt (* t_1 (* F (* 2.0 (* 2.0 A))))))))
     (if (<= (pow B_m 2.0) 1e+163)
       (* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) t_0)
       (* t_0 (sqrt (* F (- A (hypot B_m A)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0) / B_m;
	double t_1 = fma(A, (C * -4.0), pow(B_m, 2.0));
	double tmp;
	if (pow(B_m, 2.0) <= 4e+123) {
		tmp = 1.0 / (t_1 / -sqrt((t_1 * (F * (2.0 * (2.0 * A))))));
	} else if (pow(B_m, 2.0) <= 1e+163) {
		tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * t_0;
	} else {
		tmp = t_0 * sqrt((F * (A - hypot(B_m, A))));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(Float64(-sqrt(2.0)) / B_m)
	t_1 = fma(A, Float64(C * -4.0), (B_m ^ 2.0))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 4e+123)
		tmp = Float64(1.0 / Float64(t_1 / Float64(-sqrt(Float64(t_1 * Float64(F * Float64(2.0 * Float64(2.0 * A))))))));
	elseif ((B_m ^ 2.0) <= 1e+163)
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * t_0);
	else
		tmp = Float64(t_0 * sqrt(Float64(F * Float64(A - hypot(B_m, A)))));
	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]}, Block[{t$95$1 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+123], N[(1.0 / N[(t$95$1 / (-N[Sqrt[N[(t$95$1 * N[(F * N[(2.0 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+163], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 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])\\
\\
\begin{array}{l}
t_0 := \frac{-\sqrt{2}}{B_m}\\
t_1 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\
\mathbf{if}\;{B_m}^{2} \leq 4 \cdot 10^{+123}:\\
\;\;\;\;\frac{1}{\frac{t_1}{-\sqrt{t_1 \cdot \left(F \cdot \left(2 \cdot \left(2 \cdot A\right)\right)\right)}}}\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 44.8% 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} t_0 := \frac{-\sqrt{2}}{B_m}\\ t_1 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\ \mathbf{if}\;{B_m}^{2} \leq 4 \cdot 10^{+123}:\\ \;\;\;\;\sqrt{t_1 \cdot \left(F \cdot \left(2 \cdot \left(2 \cdot A\right)\right)\right)} \cdot \frac{-1}{t_1}\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\ \;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\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)) (t_1 (fma A (* C -4.0) (pow B_m 2.0))))
   (if (<= (pow B_m 2.0) 4e+123)
     (* (sqrt (* t_1 (* F (* 2.0 (* 2.0 A))))) (/ -1.0 t_1))
     (if (<= (pow B_m 2.0) 1e+163)
       (* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) t_0)
       (* t_0 (sqrt (* F (- A (hypot B_m A)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0) / B_m;
	double t_1 = fma(A, (C * -4.0), pow(B_m, 2.0));
	double tmp;
	if (pow(B_m, 2.0) <= 4e+123) {
		tmp = sqrt((t_1 * (F * (2.0 * (2.0 * A))))) * (-1.0 / t_1);
	} else if (pow(B_m, 2.0) <= 1e+163) {
		tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * t_0;
	} else {
		tmp = t_0 * sqrt((F * (A - hypot(B_m, A))));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(Float64(-sqrt(2.0)) / B_m)
	t_1 = fma(A, Float64(C * -4.0), (B_m ^ 2.0))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 4e+123)
		tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(2.0 * Float64(2.0 * A))))) * Float64(-1.0 / t_1));
	elseif ((B_m ^ 2.0) <= 1e+163)
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * t_0);
	else
		tmp = Float64(t_0 * sqrt(Float64(F * Float64(A - hypot(B_m, A)))));
	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]}, Block[{t$95$1 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+123], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(2.0 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+163], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 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])\\
\\
\begin{array}{l}
t_0 := \frac{-\sqrt{2}}{B_m}\\
t_1 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\
\mathbf{if}\;{B_m}^{2} \leq 4 \cdot 10^{+123}:\\
\;\;\;\;\sqrt{t_1 \cdot \left(F \cdot \left(2 \cdot \left(2 \cdot A\right)\right)\right)} \cdot \frac{-1}{t_1}\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 43.7% 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} t_0 := -\sqrt{2}\\ t_1 := \frac{t_0}{B_m}\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-156}:\\ \;\;\;\;\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}^{2} \leq 2 \cdot 10^{-47}:\\ \;\;\;\;\frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B_m\right)\right)} \cdot \left(B_m \cdot t_0\right)}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\ \;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\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))) (t_1 (/ t_0 B_m)))
   (if (<= (pow B_m 2.0) 2e-156)
     (/
      (- (sqrt (* -8.0 (* (* A C) (* F (+ A A))))))
      (fma A (* C -4.0) (pow B_m 2.0)))
     (if (<= (pow B_m 2.0) 2e-47)
       (/
        (* (sqrt (* F (- A (hypot A B_m)))) (* B_m t_0))
        (fma B_m B_m (* A (* C -4.0))))
       (if (<= (pow B_m 2.0) 1e+163)
         (* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) t_1)
         (* t_1 (sqrt (* F (- A (hypot B_m A))))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double t_1 = t_0 / B_m;
	double tmp;
	if (pow(B_m, 2.0) <= 2e-156) {
		tmp = -sqrt((-8.0 * ((A * C) * (F * (A + A))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	} else if (pow(B_m, 2.0) <= 2e-47) {
		tmp = (sqrt((F * (A - hypot(A, B_m)))) * (B_m * t_0)) / fma(B_m, B_m, (A * (C * -4.0)));
	} else if (pow(B_m, 2.0) <= 1e+163) {
		tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * t_1;
	} else {
		tmp = t_1 * sqrt((F * (A - hypot(B_m, A))));
	}
	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))
	t_1 = Float64(t_0 / B_m)
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-156)
		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.0) <= 2e-47)
		tmp = Float64(Float64(sqrt(Float64(F * Float64(A - hypot(A, B_m)))) * Float64(B_m * t_0)) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))));
	elseif ((B_m ^ 2.0) <= 1e+163)
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * t_1);
	else
		tmp = Float64(t_1 * sqrt(Float64(F * Float64(A - hypot(B_m, A)))));
	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[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(t$95$0 / B$95$m), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-156], 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[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-47], N[(N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(B$95$m * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+163], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 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])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := \frac{t_0}{B_m}\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-156}:\\
\;\;\;\;\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}^{2} \leq 2 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B_m\right)\right)} \cdot \left(B_m \cdot t_0\right)}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_1\\

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 43.7% 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} t_0 := \frac{-\sqrt{2}}{B_m}\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-156}:\\ \;\;\;\;\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}^{2} \leq 2 \cdot 10^{-47} \lor \neg \left({B_m}^{2} \leq 10^{+163}\right):\\ \;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\ \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 (<= (pow B_m 2.0) 2e-156)
     (/
      (- (sqrt (* -8.0 (* (* A C) (* F (+ A A))))))
      (fma A (* C -4.0) (pow B_m 2.0)))
     (if (or (<= (pow B_m 2.0) 2e-47) (not (<= (pow B_m 2.0) 1e+163)))
       (* t_0 (sqrt (* F (- A (hypot B_m A)))))
       (* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) t_0)))))
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 (pow(B_m, 2.0) <= 2e-156) {
		tmp = -sqrt((-8.0 * ((A * C) * (F * (A + A))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	} else if ((pow(B_m, 2.0) <= 2e-47) || !(pow(B_m, 2.0) <= 1e+163)) {
		tmp = t_0 * sqrt((F * (A - hypot(B_m, A))));
	} else {
		tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * t_0;
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(Float64(-sqrt(2.0)) / B_m)
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-156)
		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.0) <= 2e-47) || !((B_m ^ 2.0) <= 1e+163))
		tmp = Float64(t_0 * sqrt(Float64(F * Float64(A - hypot(B_m, A)))));
	else
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * t_0);
	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[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-156], 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[Or[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-47], N[Not[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+163]], $MachinePrecision]], N[(t$95$0 * N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $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}^{2} \leq 2 \cdot 10^{-156}:\\
\;\;\;\;\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}^{2} \leq 2 \cdot 10^{-47} \lor \neg \left({B_m}^{2} \leq 10^{+163}\right):\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 44.7% accurate, 1.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 := \frac{-\sqrt{2}}{B_m}\\ \mathbf{if}\;{B_m}^{2} \leq 4 \cdot 10^{+123}:\\ \;\;\;\;\frac{-\sqrt{4 \cdot \left(A \cdot \left(F \cdot \left({B_m}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\ \;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\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 (<= (pow B_m 2.0) 4e+123)
     (/
      (- (sqrt (* 4.0 (* A (* F (+ (pow B_m 2.0) (* -4.0 (* A C))))))))
      (fma A (* C -4.0) (pow B_m 2.0)))
     (if (<= (pow B_m 2.0) 1e+163)
       (* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) t_0)
       (* t_0 (sqrt (* F (- A (hypot B_m A)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0) / B_m;
	double tmp;
	if (pow(B_m, 2.0) <= 4e+123) {
		tmp = -sqrt((4.0 * (A * (F * (pow(B_m, 2.0) + (-4.0 * (A * C))))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	} else if (pow(B_m, 2.0) <= 1e+163) {
		tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * t_0;
	} else {
		tmp = t_0 * sqrt((F * (A - hypot(B_m, A))));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(Float64(-sqrt(2.0)) / B_m)
	tmp = 0.0
	if ((B_m ^ 2.0) <= 4e+123)
		tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(A * Float64(F * Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)));
	elseif ((B_m ^ 2.0) <= 1e+163)
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * t_0);
	else
		tmp = Float64(t_0 * sqrt(Float64(F * Float64(A - hypot(B_m, A)))));
	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[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+123], N[((-N[Sqrt[N[(4.0 * N[(A * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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], 1e+163], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 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])\\
\\
\begin{array}{l}
t_0 := \frac{-\sqrt{2}}{B_m}\\
\mathbf{if}\;{B_m}^{2} \leq 4 \cdot 10^{+123}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(A \cdot \left(F \cdot \left({B_m}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+163}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 34.3% 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} t_0 := \frac{-\sqrt{2}}{B_m}\\ \mathbf{if}\;C \leq 3.6 \cdot 10^{+84}:\\ \;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\ \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 (<= C 3.6e+84)
     (* t_0 (sqrt (* F (- A (hypot B_m A)))))
     (* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) t_0))))
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 (C <= 3.6e+84) {
		tmp = t_0 * sqrt((F * (A - hypot(B_m, A))));
	} else {
		tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * t_0;
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double t_0 = -Math.sqrt(2.0) / B_m;
	double tmp;
	if (C <= 3.6e+84) {
		tmp = t_0 * Math.sqrt((F * (A - Math.hypot(B_m, A))));
	} else {
		tmp = Math.sqrt((F * (-0.5 * (Math.pow(B_m, 2.0) / C)))) * t_0;
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	t_0 = -math.sqrt(2.0) / B_m
	tmp = 0
	if C <= 3.6e+84:
		tmp = t_0 * math.sqrt((F * (A - math.hypot(B_m, A))))
	else:
		tmp = math.sqrt((F * (-0.5 * (math.pow(B_m, 2.0) / C)))) * t_0
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(Float64(-sqrt(2.0)) / B_m)
	tmp = 0.0
	if (C <= 3.6e+84)
		tmp = Float64(t_0 * sqrt(Float64(F * Float64(A - hypot(B_m, A)))));
	else
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * t_0);
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	t_0 = -sqrt(2.0) / B_m;
	tmp = 0.0;
	if (C <= 3.6e+84)
		tmp = t_0 * sqrt((F * (A - hypot(B_m, A))));
	else
		tmp = sqrt((F * (-0.5 * ((B_m ^ 2.0) / C)))) * t_0;
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]}, If[LessEqual[C, 3.6e+84], N[(t$95$0 * N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $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}\;C \leq 3.6 \cdot 10^{+84}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{C}\right)} \cdot t_0\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 31.2% 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 \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\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 B_m A))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (-sqrt(2.0) / B_m) * sqrt((F * (A - hypot(B_m, A))));
}
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(B_m, A))));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (-math.sqrt(2.0) / B_m) * math.sqrt((F * (A - math.hypot(B_m, A))))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(Float64(-sqrt(2.0)) / B_m) * sqrt(Float64(F * Float64(A - hypot(B_m, A)))))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (-sqrt(2.0) / B_m) * sqrt((F * (A - hypot(B_m, A))));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 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 \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

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

Alternative 9: 8.9% 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({\left(A \cdot F\right)}^{0.5} \cdot \frac{1}{B_m}\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 (* (pow (* A F) 0.5) (/ 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) {
	return -2.0 * (pow((A * F), 0.5) * (1.0 / B_m));
}
B_m = abs(B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = (-2.0d0) * (((a * f) ** 0.5d0) * (1.0d0 / b_m))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return -2.0 * (Math.pow((A * F), 0.5) * (1.0 / B_m));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return -2.0 * (math.pow((A * F), 0.5) * (1.0 / B_m))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) * Float64(1.0 / B_m)))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = -2.0 * (((A * F) ^ 0.5) * (1.0 / B_m));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] * N[(1.0 / B$95$m), $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({\left(A \cdot F\right)}^{0.5} \cdot \frac{1}{B_m}\right)
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 8.9% 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 \sqrt{A \cdot F}\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) (sqrt (* A F)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return -2.0 * ((1.0 / B_m) * sqrt((A * F)));
}
B_m = abs(B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = (-2.0d0) * ((1.0d0 / b_m) * sqrt((a * f)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return -2.0 * ((1.0 / B_m) * Math.sqrt((A * F)));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return -2.0 * ((1.0 / B_m) * math.sqrt((A * F)))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(-2.0 * Float64(Float64(1.0 / B_m) * sqrt(Float64(A * F))))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = -2.0 * ((1.0 / B_m) * sqrt((A * F)));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(-2.0 * N[(N[(1.0 / B$95$m), $MachinePrecision] * N[Sqrt[N[(A * F), $MachinePrecision]], $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 \sqrt{A \cdot F}\right)
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 8.9% accurate, 5.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{-2 \cdot \sqrt{A \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 (* A 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((A * 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((a * 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((A * 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((A * 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(Float64(-2.0 * sqrt(Float64(A * 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((A * 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[(N[(-2.0 * N[Sqrt[N[(A * F), $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{-2 \cdot \sqrt{A \cdot F}}{B_m}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Reproduce

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