ABCF->ab-angle a

Percentage Accurate: 19.4% → 42.9%
Time: 28.7s
Alternatives: 7
Speedup: 6.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 7 alternatives:

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

Initial Program: 19.4% accurate, 1.0× speedup?

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

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

Alternative 1: 42.9% accurate, 1.5× 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{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \left(-\sqrt{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 (+ C (hypot B_m C))) (- (sqrt 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((C + hypot(B_m, C))) * -sqrt(F));
}
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((C + Math.hypot(B_m, C))) * -Math.sqrt(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((C + math.hypot(B_m, C))) * -math.sqrt(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(C + hypot(B_m, C))) * Float64(-sqrt(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((C + hypot(B_m, C))) * -sqrt(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[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[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{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \left(-\sqrt{F}\right)\right)
\end{array}
Derivation
  1. Initial program 17.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    3. unpow-prod-down19.0%

      \[\leadsto \color{blue}{\left({\left(C + \mathsf{hypot}\left(B, C\right)\right)}^{0.5} \cdot {F}^{0.5}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    4. pow1/219.0%

      \[\leadsto \left(\color{blue}{\sqrt{C + \mathsf{hypot}\left(B, C\right)}} \cdot {F}^{0.5}\right) \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    5. pow1/219.0%

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

    \[\leadsto \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
  8. Final simplification19.0%

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

Alternative 2: 35.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])\\ \\ -\sqrt{\frac{1}{B\_m}} \cdot \sqrt{F \cdot 2} \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 (/ 1.0 B_m)) (sqrt (* F 2.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) {
	return -(sqrt((1.0 / B_m)) * sqrt((F * 2.0)));
}
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((1.0d0 / b_m)) * sqrt((f * 2.0d0)))
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((1.0 / B_m)) * Math.sqrt((F * 2.0)));
}
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((1.0 / B_m)) * math.sqrt((F * 2.0)))
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(Float64(1.0 / B_m)) * sqrt(Float64(F * 2.0))))
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((1.0 / B_m)) * sqrt((F * 2.0)));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := (-N[(N[Sqrt[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{1}{B\_m}} \cdot \sqrt{F \cdot 2}
\end{array}
Derivation
  1. Initial program 17.7%

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    2. *-commutative12.8%

      \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    3. distribute-rgt-neg-in12.8%

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

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

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

      \[\leadsto {\color{blue}{\left(-\sqrt{2} \cdot \sqrt{\frac{F}{B}}\right)}}^{1} \]
    3. pow1/212.8%

      \[\leadsto {\left(-\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{F}{B}}\right)}^{1} \]
    4. pow1/213.1%

      \[\leadsto {\left(-{2}^{0.5} \cdot \color{blue}{{\left(\frac{F}{B}\right)}^{0.5}}\right)}^{1} \]
    5. pow-prod-down13.1%

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

    \[\leadsto \color{blue}{{\left(-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}\right)}^{1}} \]
  8. Step-by-step derivation
    1. unpow113.1%

      \[\leadsto \color{blue}{-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}} \]
    2. unpow1/212.9%

      \[\leadsto -\color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
    3. associate-*r/12.9%

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

    \[\leadsto \color{blue}{-\sqrt{\frac{2 \cdot F}{B}}} \]
  10. Step-by-step derivation
    1. pow1/213.1%

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

      \[\leadsto -{\color{blue}{\left(\left(2 \cdot F\right) \cdot \frac{1}{B}\right)}}^{0.5} \]
    3. unpow-prod-down16.3%

      \[\leadsto -\color{blue}{{\left(2 \cdot F\right)}^{0.5} \cdot {\left(\frac{1}{B}\right)}^{0.5}} \]
    4. pow1/216.3%

      \[\leadsto -\color{blue}{\sqrt{2 \cdot F}} \cdot {\left(\frac{1}{B}\right)}^{0.5} \]
    5. metadata-eval16.3%

      \[\leadsto -\sqrt{\color{blue}{{2}^{1}} \cdot F} \cdot {\left(\frac{1}{B}\right)}^{0.5} \]
    6. metadata-eval16.3%

      \[\leadsto -\sqrt{{2}^{\color{blue}{\left(\frac{2}{2}\right)}} \cdot F} \cdot {\left(\frac{1}{B}\right)}^{0.5} \]
    7. sqrt-pow216.2%

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

      \[\leadsto -\sqrt{\color{blue}{F \cdot {\left(\sqrt{2}\right)}^{2}}} \cdot {\left(\frac{1}{B}\right)}^{0.5} \]
    9. sqrt-pow216.3%

      \[\leadsto -\sqrt{F \cdot \color{blue}{{2}^{\left(\frac{2}{2}\right)}}} \cdot {\left(\frac{1}{B}\right)}^{0.5} \]
    10. metadata-eval16.3%

      \[\leadsto -\sqrt{F \cdot {2}^{\color{blue}{1}}} \cdot {\left(\frac{1}{B}\right)}^{0.5} \]
    11. metadata-eval16.3%

      \[\leadsto -\sqrt{F \cdot \color{blue}{2}} \cdot {\left(\frac{1}{B}\right)}^{0.5} \]
  11. Applied egg-rr16.3%

    \[\leadsto -\color{blue}{\sqrt{F \cdot 2} \cdot {\left(\frac{1}{B}\right)}^{0.5}} \]
  12. Step-by-step derivation
    1. unpow1/216.3%

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

      \[\leadsto -\color{blue}{\sqrt{\frac{1}{B}} \cdot \sqrt{F \cdot 2}} \]
  13. Simplified16.3%

    \[\leadsto -\color{blue}{\sqrt{\frac{1}{B}} \cdot \sqrt{F \cdot 2}} \]
  14. Final simplification16.3%

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

Alternative 3: 35.1% accurate, 3.1× speedup?

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

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    2. *-commutative12.8%

      \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    3. distribute-rgt-neg-in12.8%

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

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

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

      \[\leadsto {\color{blue}{\left(-\sqrt{2} \cdot \sqrt{\frac{F}{B}}\right)}}^{1} \]
    3. pow1/212.8%

      \[\leadsto {\left(-\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{F}{B}}\right)}^{1} \]
    4. pow1/213.1%

      \[\leadsto {\left(-{2}^{0.5} \cdot \color{blue}{{\left(\frac{F}{B}\right)}^{0.5}}\right)}^{1} \]
    5. pow-prod-down13.1%

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

    \[\leadsto \color{blue}{{\left(-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}\right)}^{1}} \]
  8. Step-by-step derivation
    1. unpow113.1%

      \[\leadsto \color{blue}{-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}} \]
    2. unpow1/212.9%

      \[\leadsto -\color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
    3. associate-*r/12.9%

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

    \[\leadsto \color{blue}{-\sqrt{\frac{2 \cdot F}{B}}} \]
  10. Step-by-step derivation
    1. sqrt-div16.3%

      \[\leadsto -\color{blue}{\frac{\sqrt{2 \cdot F}}{\sqrt{B}}} \]
    2. metadata-eval16.3%

      \[\leadsto -\frac{\sqrt{\color{blue}{{2}^{1}} \cdot F}}{\sqrt{B}} \]
    3. metadata-eval16.3%

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

      \[\leadsto -\frac{\sqrt{\color{blue}{{\left(\sqrt{2}\right)}^{2}} \cdot F}}{\sqrt{B}} \]
    5. *-commutative16.2%

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

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

      \[\leadsto -\frac{\sqrt{F \cdot {2}^{\color{blue}{1}}}}{\sqrt{B}} \]
    8. metadata-eval16.3%

      \[\leadsto -\frac{\sqrt{F \cdot \color{blue}{2}}}{\sqrt{B}} \]
  11. Applied egg-rr16.3%

    \[\leadsto -\color{blue}{\frac{\sqrt{F \cdot 2}}{\sqrt{B}}} \]
  12. Final simplification16.3%

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

Alternative 4: 27.1% accurate, 5.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ -{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F) :precision binary64 (- (pow (* 2.0 (/ F B_m)) 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 -pow((2.0 * (F / B_m)), 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 * (f / b_m)) ** 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 -Math.pow((2.0 * (F / B_m)), 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 -math.pow((2.0 * (F / B_m)), 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(-(Float64(2.0 * Float64(F / B_m)) ^ 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 * (F / B_m)) ^ 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[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}
\end{array}
Derivation
  1. Initial program 17.7%

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    2. *-commutative12.8%

      \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    3. distribute-rgt-neg-in12.8%

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

    \[\leadsto \color{blue}{\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)} \]
  6. Step-by-step derivation
    1. distribute-rgt-neg-out12.8%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    2. pow1/212.8%

      \[\leadsto -\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{F}{B}} \]
    3. pow1/213.1%

      \[\leadsto -{2}^{0.5} \cdot \color{blue}{{\left(\frac{F}{B}\right)}^{0.5}} \]
    4. pow-prod-down13.1%

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

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

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

Alternative 5: 27.1% accurate, 6.0× speedup?

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

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    2. *-commutative12.8%

      \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    3. distribute-rgt-neg-in12.8%

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

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

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

      \[\leadsto {\color{blue}{\left(-\sqrt{2} \cdot \sqrt{\frac{F}{B}}\right)}}^{1} \]
    3. pow1/212.8%

      \[\leadsto {\left(-\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{F}{B}}\right)}^{1} \]
    4. pow1/213.1%

      \[\leadsto {\left(-{2}^{0.5} \cdot \color{blue}{{\left(\frac{F}{B}\right)}^{0.5}}\right)}^{1} \]
    5. pow-prod-down13.1%

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

    \[\leadsto \color{blue}{{\left(-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}\right)}^{1}} \]
  8. Step-by-step derivation
    1. unpow113.1%

      \[\leadsto \color{blue}{-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}} \]
    2. unpow1/212.9%

      \[\leadsto -\color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
    3. associate-*r/12.9%

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

    \[\leadsto \color{blue}{-\sqrt{\frac{2 \cdot F}{B}}} \]
  10. Final simplification12.9%

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

Alternative 6: 2.4% accurate, 6.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \sqrt{2 \cdot \frac{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 (sqrt (* 2.0 (/ 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 sqrt((2.0 * (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 = sqrt((2.0d0 * (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 Math.sqrt((2.0 * (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 math.sqrt((2.0 * (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 sqrt(Float64(2.0 * Float64(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 = sqrt((2.0 * (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[Sqrt[N[(2.0 * N[(F / 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])\\
\\
\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Derivation
  1. Initial program 17.7%

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    2. *-commutative12.8%

      \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    3. distribute-rgt-neg-in12.8%

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

    \[\leadsto \color{blue}{\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)} \]
  6. Step-by-step derivation
    1. add-log-exp3.4%

      \[\leadsto \sqrt{2} \cdot \left(-\color{blue}{\log \left(e^{\sqrt{\frac{F}{B}}}\right)}\right) \]
  7. Applied egg-rr3.4%

    \[\leadsto \sqrt{2} \cdot \left(-\color{blue}{\log \left(e^{\sqrt{\frac{F}{B}}}\right)}\right) \]
  8. Step-by-step derivation
    1. metadata-eval3.4%

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

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

      \[\leadsto \sqrt{\color{blue}{{\left(\sqrt{2}\right)}^{2}}} \cdot \left(-\log \left(e^{\sqrt{\frac{F}{B}}}\right)\right) \]
    4. add-sqr-sqrt1.4%

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

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \color{blue}{\sqrt{\left(-\log \left(e^{\sqrt{\frac{F}{B}}}\right)\right) \cdot \left(-\log \left(e^{\sqrt{\frac{F}{B}}}\right)\right)}} \]
    6. sqr-neg1.8%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\color{blue}{\log \left(e^{\sqrt{\frac{F}{B}}}\right) \cdot \log \left(e^{\sqrt{\frac{F}{B}}}\right)}} \]
    7. rem-log-exp1.8%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\color{blue}{\sqrt{\frac{F}{B}}} \cdot \log \left(e^{\sqrt{\frac{F}{B}}}\right)} \]
    8. rem-log-exp2.0%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\sqrt{\frac{F}{B}} \cdot \color{blue}{\sqrt{\frac{F}{B}}}} \]
    9. add-sqr-sqrt2.0%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\color{blue}{\frac{F}{B}}} \]
    10. sqrt-prod2.0%

      \[\leadsto \color{blue}{\sqrt{{\left(\sqrt{2}\right)}^{2} \cdot \frac{F}{B}}} \]
    11. sqrt-pow22.0%

      \[\leadsto \sqrt{\color{blue}{{2}^{\left(\frac{2}{2}\right)}} \cdot \frac{F}{B}} \]
    12. metadata-eval2.0%

      \[\leadsto \sqrt{{2}^{\color{blue}{1}} \cdot \frac{F}{B}} \]
    13. metadata-eval2.0%

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

    \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
  10. Final simplification2.0%

    \[\leadsto \sqrt{2 \cdot \frac{F}{B}} \]
  11. Add Preprocessing

Alternative 7: 2.4% accurate, 6.0× speedup?

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

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    2. *-commutative12.8%

      \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    3. distribute-rgt-neg-in12.8%

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

    \[\leadsto \color{blue}{\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)} \]
  6. Step-by-step derivation
    1. add-log-exp3.4%

      \[\leadsto \sqrt{2} \cdot \left(-\color{blue}{\log \left(e^{\sqrt{\frac{F}{B}}}\right)}\right) \]
  7. Applied egg-rr3.4%

    \[\leadsto \sqrt{2} \cdot \left(-\color{blue}{\log \left(e^{\sqrt{\frac{F}{B}}}\right)}\right) \]
  8. Step-by-step derivation
    1. metadata-eval3.4%

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

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

      \[\leadsto \sqrt{\color{blue}{{\left(\sqrt{2}\right)}^{2}}} \cdot \left(-\log \left(e^{\sqrt{\frac{F}{B}}}\right)\right) \]
    4. add-sqr-sqrt1.4%

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

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \color{blue}{\sqrt{\left(-\log \left(e^{\sqrt{\frac{F}{B}}}\right)\right) \cdot \left(-\log \left(e^{\sqrt{\frac{F}{B}}}\right)\right)}} \]
    6. sqr-neg1.8%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\color{blue}{\log \left(e^{\sqrt{\frac{F}{B}}}\right) \cdot \log \left(e^{\sqrt{\frac{F}{B}}}\right)}} \]
    7. rem-log-exp1.8%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\color{blue}{\sqrt{\frac{F}{B}}} \cdot \log \left(e^{\sqrt{\frac{F}{B}}}\right)} \]
    8. rem-log-exp2.0%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\sqrt{\frac{F}{B}} \cdot \color{blue}{\sqrt{\frac{F}{B}}}} \]
    9. add-sqr-sqrt2.0%

      \[\leadsto \sqrt{{\left(\sqrt{2}\right)}^{2}} \cdot \sqrt{\color{blue}{\frac{F}{B}}} \]
    10. sqrt-prod2.0%

      \[\leadsto \color{blue}{\sqrt{{\left(\sqrt{2}\right)}^{2} \cdot \frac{F}{B}}} \]
    11. sqrt-pow22.0%

      \[\leadsto \sqrt{\color{blue}{{2}^{\left(\frac{2}{2}\right)}} \cdot \frac{F}{B}} \]
    12. metadata-eval2.0%

      \[\leadsto \sqrt{{2}^{\color{blue}{1}} \cdot \frac{F}{B}} \]
    13. metadata-eval2.0%

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

    \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
  10. Step-by-step derivation
    1. *-un-lft-identity2.0%

      \[\leadsto \color{blue}{1 \cdot \sqrt{2 \cdot \frac{F}{B}}} \]
  11. Applied egg-rr2.0%

    \[\leadsto \color{blue}{1 \cdot \sqrt{2 \cdot \frac{F}{B}}} \]
  12. Step-by-step derivation
    1. *-lft-identity2.0%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
    2. associate-*r/2.0%

      \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot F}{B}}} \]
    3. *-commutative2.0%

      \[\leadsto \sqrt{\frac{\color{blue}{F \cdot 2}}{B}} \]
  13. Simplified2.0%

    \[\leadsto \color{blue}{\sqrt{\frac{F \cdot 2}{B}}} \]
  14. Final simplification2.0%

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

Reproduce

?
herbie shell --seed 2024066 
(FPCore (A B C F)
  :name "ABCF->ab-angle a"
  :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))))