\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.0845989431502955 \cdot 10^{+87}:\\
\;\;\;\;-\frac{t_1}{-B}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
t_3 := 2 \cdot \left(F \cdot \left(A + \left(C + t_0\right)\right)\right)\\
\mathbf{if}\;B \leq -1.61868603355462 \cdot 10^{-258}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot t_3}}{t_2}\\
\mathbf{elif}\;B \leq 3.197177902139795 \cdot 10^{-89}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 5.520316977367989 \cdot 10^{-9}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt{\mathsf{hypot}\left(\sqrt{A \cdot \left(C \cdot -4\right)}, B\right)}\\
-\frac{\sqrt{t_3}}{t_4 \cdot t_4}
\end{array}\\
\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.0845989431502955e+87)
(- (/ t_1 (- B)))
(let* ((t_2 (fma A (* C -4.0) (* B B)))
(t_3 (* 2.0 (* F (+ A (+ C t_0))))))
(if (<= B -1.61868603355462e-258)
(/ (- (sqrt (* t_2 t_3))) t_2)
(if (<= B 3.197177902139795e-89)
(/ (- (sqrt (* t_2 (* 2.0 (* F (* 2.0 A)))))) t_2)
(if (<= B 5.520316977367989e-9)
(let* ((t_4 (sqrt (hypot (sqrt (* A (* C -4.0))) B))))
(- (/ (sqrt t_3) (* t_4 t_4))))
(- (/ 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.0845989431502955e+87) {
tmp = -(t_1 / -B);
} else {
double t_2 = fma(A, (C * -4.0), (B * B));
double t_3 = 2.0 * (F * (A + (C + t_0)));
double tmp_1;
if (B <= -1.61868603355462e-258) {
tmp_1 = -sqrt(t_2 * t_3) / t_2;
} else if (B <= 3.197177902139795e-89) {
tmp_1 = -sqrt(t_2 * (2.0 * (F * (2.0 * A)))) / t_2;
} else if (B <= 5.520316977367989e-9) {
double t_4 = sqrt(hypot(sqrt(A * (C * -4.0)), B));
tmp_1 = -(sqrt(t_3) / (t_4 * t_4));
} 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.08459894315029553e87Initial program 59.9
Simplified58.9
Applied add-sqr-sqrt_binary6459.1
Applied sqrt-prod_binary6453.6
Applied distribute-lft-neg-in_binary6453.6
Applied times-frac_binary6453.6
Simplified52.0
Taylor expanded in B around -inf 28.9
Simplified28.9
if -1.08459894315029553e87 < B < -1.6186860335546199e-258Initial program 47.6
Simplified42.9
Applied associate-+l+_binary6442.0
if -1.6186860335546199e-258 < B < 3.1971779021397953e-89Initial program 52.5
Simplified47.4
Taylor expanded in A around inf 49.0
if 3.1971779021397953e-89 < B < 5.5203169773679886e-9Initial program 46.0
Simplified40.9
Applied add-sqr-sqrt_binary6445.8
Applied sqrt-prod_binary6442.4
Applied distribute-lft-neg-in_binary6442.4
Applied times-frac_binary6442.3
Simplified42.2
Applied add-sqr-sqrt_binary6442.3
Simplified46.1
Simplified46.1
Applied associate-+l+_binary6445.5
if 5.5203169773679886e-9 < B Initial program 54.0
Simplified52.3
Applied add-sqr-sqrt_binary6452.9
Applied sqrt-prod_binary6447.5
Applied distribute-lft-neg-in_binary6447.5
Applied times-frac_binary6447.4
Simplified46.4
Taylor expanded in A around 0 32.8
Final simplification39.1
herbie shell --seed 2022019
(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))))