\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 -0.021493238530669236:\\
\;\;\;\;-\frac{t_1}{2 \cdot \frac{A \cdot C}{B} - B}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
t_3 := \frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(A + \left(C + t_0\right)\right)\right)\right)}}{t_2}\\
\mathbf{if}\;B \leq 6.3763417357519274 \cdot 10^{-254}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;B \leq 7.677474179576165 \cdot 10^{-97}:\\
\;\;\;\;\frac{-A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(F \cdot C\right)}\right)}{t_2}\\
\mathbf{elif}\;B \leq 9.636869577966142 \cdot 10^{+73}:\\
\;\;\;\;t_3\\
\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 -0.021493238530669236)
(- (/ t_1 (- (* 2.0 (/ (* A C) B)) B)))
(let* ((t_2 (fma A (* C -4.0) (* B B)))
(t_3 (/ (- (sqrt (* t_2 (* 2.0 (* F (+ A (+ C t_0))))))) t_2)))
(if (<= B 6.3763417357519274e-254)
t_3
(if (<= B 7.677474179576165e-97)
(/ (- (* A (* (sqrt 2.0) (sqrt (* -8.0 (* F C)))))) t_2)
(if (<= B 9.636869577966142e+73) t_3 (- (/ 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 <= -0.021493238530669236) {
tmp = -(t_1 / ((2.0 * ((A * C) / B)) - B));
} else {
double t_2 = fma(A, (C * -4.0), (B * B));
double t_3 = -sqrt(t_2 * (2.0 * (F * (A + (C + t_0))))) / t_2;
double tmp_1;
if (B <= 6.3763417357519274e-254) {
tmp_1 = t_3;
} else if (B <= 7.677474179576165e-97) {
tmp_1 = -(A * (sqrt(2.0) * sqrt(-8.0 * (F * C)))) / t_2;
} else if (B <= 9.636869577966142e+73) {
tmp_1 = t_3;
} 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 < -0.021493238530669236Initial program 54.6
Simplified52.5
Applied add-sqr-sqrt_binary6453.1
Applied sqrt-prod_binary6448.5
Applied distribute-lft-neg-in_binary6448.5
Applied times-frac_binary6448.4
Simplified47.3
Taylor expanded in B around -inf 33.7
if -0.021493238530669236 < B < 6.3763417357519274e-254 or 7.67747417957616513e-97 < B < 9.63686957796614202e73Initial program 46.8
Simplified42.1
Applied associate-+l+_binary6441.1
if 6.3763417357519274e-254 < B < 7.67747417957616513e-97Initial program 52.3
Simplified48.2
Taylor expanded in A around inf 49.9
if 9.63686957796614202e73 < B Initial program 58.3
Simplified57.3
Applied add-sqr-sqrt_binary6457.5
Applied sqrt-prod_binary6452.1
Applied distribute-lft-neg-in_binary6452.1
Applied times-frac_binary6452.1
Simplified50.6
Taylor expanded in A around 0 29.4
Final simplification38.1
herbie shell --seed 2022068
(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))))