\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 -5.66563505439078 \cdot 10^{+123}:\\
\;\;\;\;-\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 -8.208527862976466 \cdot 10^{-93}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(A + \left(C + t_0\right)\right)\right)}}{\sqrt{t_2}}\\
\mathbf{elif}\;B \leq 1.9737339501045438 \cdot 10^{-245}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot C\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 0.00018787339796933887:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A - 0.5 \cdot \frac{{B}^{2}}{C}\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 -5.66563505439078e+123)
(- (/ t_1 (- B)))
(let* ((t_2 (fma A (* C -4.0) (* B B))))
(if (<= B -8.208527862976466e-93)
(- (/ (sqrt (* 2.0 (* F (+ A (+ C t_0))))) (sqrt t_2)))
(if (<= B 1.9737339501045438e-245)
(/ (- (sqrt (* t_2 (* 2.0 (* F (* 2.0 C)))))) t_2)
(if (<= B 0.00018787339796933887)
(/
(-
(sqrt
(* t_2 (* 2.0 (* F (- (* 2.0 A) (* 0.5 (/ (pow B 2.0) C))))))))
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 <= -5.66563505439078e+123) {
tmp = -(t_1 / -B);
} else {
double t_2 = fma(A, (C * -4.0), (B * B));
double tmp_1;
if (B <= -8.208527862976466e-93) {
tmp_1 = -(sqrt(2.0 * (F * (A + (C + t_0)))) / sqrt(t_2));
} else if (B <= 1.9737339501045438e-245) {
tmp_1 = -sqrt(t_2 * (2.0 * (F * (2.0 * C)))) / t_2;
} else if (B <= 0.00018787339796933887) {
tmp_1 = -sqrt(t_2 * (2.0 * (F * ((2.0 * A) - (0.5 * (pow(B, 2.0) / C)))))) / 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 < -5.66563505439077979e123Initial program 62.3
Simplified61.9
Applied add-sqr-sqrt_binary6461.9
Applied sqrt-prod_binary6458.6
Applied distribute-lft-neg-in_binary6458.6
Applied times-frac_binary6458.6
Simplified56.9
Taylor expanded in B around -inf 32.1
Simplified32.1
if -5.66563505439077979e123 < B < -8.20852786297646631e-93Initial program 43.8
Simplified39.7
Applied add-sqr-sqrt_binary6442.1
Applied sqrt-prod_binary6436.6
Applied distribute-lft-neg-in_binary6436.6
Applied times-frac_binary6436.5
Simplified36.3
Applied associate-+l+_binary6436.1
if -8.20852786297646631e-93 < B < 1.97373395010454378e-245Initial program 52.8
Simplified47.8
Taylor expanded in A around -inf 48.7
if 1.97373395010454378e-245 < B < 1.8787339796933887e-4Initial program 48.5
Simplified43.7
Taylor expanded in C around -inf 49.4
if 1.8787339796933887e-4 < B Initial program 54.3
Simplified52.8
Applied add-sqr-sqrt_binary6453.3
Applied sqrt-prod_binary6448.3
Applied distribute-lft-neg-in_binary6448.3
Applied times-frac_binary6448.3
Simplified47.1
Taylor expanded in A around 0 31.8
Final simplification39.8
herbie shell --seed 2021215
(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))))