\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 := \mathsf{hypot}\left(B, A - C\right)\\
t_1 := \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) + t_0\right)\right)}\\
\mathbf{if}\;B \leq -1.5619060822104954 \cdot 10^{-55}:\\
\;\;\;\;-\frac{t_1}{-B}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
\mathbf{if}\;B \leq -2.334124987632853 \cdot 10^{-149}:\\
\;\;\;\;\begin{array}{l}
t_3 := {C}^{2} + {B}^{2}\\
\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(\left(A + \left(C + \sqrt{t_3}\right)\right) - \left(A \cdot C\right) \cdot \sqrt{\frac{1}{t_3}}\right)\right)\right)}}{t_2}
\end{array}\\
\mathbf{elif}\;B \leq 5.921190070942864 \cdot 10^{-305}:\\
\;\;\;\;-\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\\
\mathbf{elif}\;B \leq 1.1537023131265152 \cdot 10^{-231}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot C - 0.5 \cdot \frac{{B}^{2}}{A}\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 2.0896203261491497 \cdot 10^{-160}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 1.5083090188140372 \cdot 10^{-5}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(A + \left(C + t_0\right)\right)\right)\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;-\frac{t_1}{B}\\
\end{array}\\
\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 (hypot B (- A C))) (t_1 (sqrt (* 2.0 (* F (+ (+ A C) t_0))))))
(if (<= B -1.5619060822104954e-55)
(- (/ t_1 (- B)))
(let* ((t_2 (fma A (* C -4.0) (* B B))))
(if (<= B -2.334124987632853e-149)
(let* ((t_3 (+ (pow C 2.0) (pow B 2.0))))
(/
(-
(sqrt
(*
t_2
(*
2.0
(*
F
(- (+ A (+ C (sqrt t_3))) (* (* A C) (sqrt (/ 1.0 t_3)))))))))
t_2))
(if (<= B 5.921190070942864e-305)
(- (* (sqrt (* -0.5 (/ F C))) (sqrt 2.0)))
(if (<= B 1.1537023131265152e-231)
(/
(-
(sqrt
(* t_2 (* 2.0 (* F (- (* 2.0 C) (* 0.5 (/ (pow B 2.0) A))))))))
t_2)
(if (<= B 2.0896203261491497e-160)
(/ (- (sqrt (* t_2 (* 2.0 (* F (* 2.0 A)))))) t_2)
(if (<= B 1.5083090188140372e-5)
(/ (- (sqrt (* t_2 (* 2.0 (* F (+ A (+ C t_0))))))) t_2)
(- (/ t_1 B)))))))))))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 = hypot(B, (A - C));
double t_1 = sqrt(2.0 * (F * ((A + C) + t_0)));
double tmp;
if (B <= -1.5619060822104954e-55) {
tmp = -(t_1 / -B);
} else {
double t_2 = fma(A, (C * -4.0), (B * B));
double tmp_1;
if (B <= -2.334124987632853e-149) {
double t_3_2 = pow(C, 2.0) + pow(B, 2.0);
tmp_1 = -sqrt(t_2 * (2.0 * (F * ((A + (C + sqrt(t_3_2))) - ((A * C) * sqrt(1.0 / t_3_2)))))) / t_2;
} else if (B <= 5.921190070942864e-305) {
tmp_1 = -(sqrt(-0.5 * (F / C)) * sqrt(2.0));
} else if (B <= 1.1537023131265152e-231) {
tmp_1 = -sqrt(t_2 * (2.0 * (F * ((2.0 * C) - (0.5 * (pow(B, 2.0) / A)))))) / t_2;
} else if (B <= 2.0896203261491497e-160) {
tmp_1 = -sqrt(t_2 * (2.0 * (F * (2.0 * A)))) / t_2;
} else if (B <= 1.5083090188140372e-5) {
tmp_1 = -sqrt(t_2 * (2.0 * (F * (A + (C + t_0))))) / t_2;
} else {
tmp_1 = -(t_1 / B);
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
if B < -1.56190608221049542e-55Initial program 53.0
Simplified50.7
Applied add-sqr-sqrt_binary6451.8
Applied sqrt-prod_binary6446.9
Applied distribute-lft-neg-in_binary6446.9
Applied times-frac_binary6446.8
Simplified45.9
Taylor expanded in B around -inf 34.4
Simplified34.4
if -1.56190608221049542e-55 < B < -2.334124987632853e-149Initial program 48.1
Simplified44.5
Taylor expanded in A around 0 48.1
if -2.334124987632853e-149 < B < 5.9211900709428638e-305Initial program 53.8
Simplified50.0
Taylor expanded in A around inf 51.7
Simplified51.7
if 5.9211900709428638e-305 < B < 1.1537023131265152e-231Initial program 52.7
Simplified47.7
Taylor expanded in A around -inf 48.8
if 1.1537023131265152e-231 < B < 2.08962032614914968e-160Initial program 53.0
Simplified49.7
Taylor expanded in A around inf 46.9
if 2.08962032614914968e-160 < B < 1.5083090188140372e-5Initial program 48.3
Simplified42.4
Applied associate-+l+_binary6441.4
if 1.5083090188140372e-5 < B Initial program 54.4
Simplified52.9
Applied add-sqr-sqrt_binary6453.4
Applied sqrt-prod_binary6448.0
Applied distribute-lft-neg-in_binary6448.0
Applied times-frac_binary6447.9
Simplified46.7
Taylor expanded in A around 0 31.7
Final simplification39.4
herbie shell --seed 2021313
(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))))