\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}
\begin{array}{l}
t_0 := B \cdot B - \left(4 \cdot A\right) \cdot C\\
t_1 := \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}\\
t_2 := \frac{-\left(\sqrt{t_0} \cdot {\left(F \cdot 2\right)}^{0.5}\right) \cdot t_1}{t_0}\\
\mathbf{if}\;A \leq -2.592644457333761 \cdot 10^{-17}:\\
\;\;\;\;-1 \cdot \left(\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}\right)\\
\mathbf{elif}\;A \leq -2.1406366566139761 \cdot 10^{-134}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{t_0}\\
\mathbf{elif}\;A \leq 1.9811684140282612 \cdot 10^{-269}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;A \leq 1.1150151595515204 \cdot 10^{+54}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \frac{t_0 \cdot F}{1}} \cdot t_1}{t_0}\\
\mathbf{elif}\;A \leq 3.718423827809515 \cdot 10^{+173}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\right)\\
\end{array}
(FPCore (A B C F)
: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))))(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* 4.0 A) C)))
(t_1 (sqrt (+ (+ A C) (hypot B (- A C)))))
(t_2 (/ (- (* (* (sqrt t_0) (pow (* F 2.0) 0.5)) t_1)) t_0)))
(if (<= A -2.592644457333761e-17)
(* -1.0 (* (sqrt 2.0) (sqrt (* -0.5 (/ F A)))))
(if (<= A -2.1406366566139761e-134)
(/ (- (sqrt (* -16.0 (* (pow A 2.0) (* C F))))) t_0)
(if (<= A 1.9811684140282612e-269)
t_2
(if (<= A 1.1150151595515204e+54)
(/ (- (* (sqrt (* 2.0 (/ (* t_0 F) 1.0))) t_1)) t_0)
(if (<= A 3.718423827809515e+173)
t_2
(* -1.0 (* (sqrt (* -0.5 (/ F C))) (sqrt 2.0))))))))))double code(double A, double B, double C, double F) {
return -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));
}
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((4.0 * A) * C);
double t_1 = sqrt(((A + C) + hypot(B, (A - C))));
double t_2 = -((sqrt(t_0) * pow((F * 2.0), 0.5)) * t_1) / t_0;
double tmp;
if (A <= -2.592644457333761e-17) {
tmp = -1.0 * (sqrt(2.0) * sqrt((-0.5 * (F / A))));
} else if (A <= -2.1406366566139761e-134) {
tmp = -sqrt((-16.0 * (pow(A, 2.0) * (C * F)))) / t_0;
} else if (A <= 1.9811684140282612e-269) {
tmp = t_2;
} else if (A <= 1.1150151595515204e+54) {
tmp = -(sqrt((2.0 * ((t_0 * F) / 1.0))) * t_1) / t_0;
} else if (A <= 3.718423827809515e+173) {
tmp = t_2;
} else {
tmp = -1.0 * (sqrt((-0.5 * (F / C))) * sqrt(2.0));
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
Results
if A < -2.5926444573337611e-17Initial program 59.7
Simplified58.5
Taylor expanded in C around inf 41.5
if -2.5926444573337611e-17 < A < -2.14063665661397612e-134Initial program 48.6
Simplified45.6
Taylor expanded in A around inf 55.4
if -2.14063665661397612e-134 < A < 1.9811684140282612e-269 or 1.1150151595515204e54 < A < 3.718423827809515e173Initial program 46.4
Simplified43.3
Applied egg-rr38.4
Applied egg-rr38.6
if 1.9811684140282612e-269 < A < 1.1150151595515204e54Initial program 44.0
Simplified41.1
Applied egg-rr36.7
Applied egg-rr36.7
if 3.718423827809515e173 < A Initial program 64.0
Simplified53.1
Taylor expanded in A around inf 46.2
Final simplification41.3
herbie shell --seed 2022127
(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))))