\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{fma}\left(A, C \cdot -4, B \cdot B\right)\\
\mathbf{if}\;C \leq -5.699986030362876 \cdot 10^{-108}:\\
\;\;\;\;\frac{A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(C \cdot F\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \mathsf{hypot}\left(B, A - C\right)\\
\mathbf{if}\;C \leq -3.073995699162904 \cdot 10^{-304}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(2 \cdot \left(F \cdot \left(A + \left(C - t_1\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 3.028623453697263 \cdot 10^{+21}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(\left(C + A\right) - t_1\right)\right)}}{\sqrt{t_0}}\\
\mathbf{else}:\\
\;\;\;\;-\frac{{\left(-F\right)}^{0.5}}{\sqrt{C}}\\
\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 (fma A (* C -4.0) (* B B))))
(if (<= C -5.699986030362876e-108)
(/ (* A (* (sqrt 2.0) (sqrt (* -8.0 (* C F))))) t_0)
(let* ((t_1 (hypot B (- A C))))
(if (<= C -3.073995699162904e-304)
(/ (- (sqrt (* t_0 (* 2.0 (* F (+ A (- C t_1))))))) t_0)
(if (<= C 3.028623453697263e+21)
(- (/ (sqrt (* 2.0 (* F (- (+ C A) t_1)))) (sqrt t_0)))
(- (/ (pow (- F) 0.5) (sqrt C)))))))))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 = fma(A, (C * -4.0), (B * B));
double tmp;
if (C <= -5.699986030362876e-108) {
tmp = (A * (sqrt(2.0) * sqrt(-8.0 * (C * F)))) / t_0;
} else {
double t_1 = hypot(B, (A - C));
double tmp_1;
if (C <= -3.073995699162904e-304) {
tmp_1 = -sqrt(t_0 * (2.0 * (F * (A + (C - t_1))))) / t_0;
} else if (C <= 3.028623453697263e+21) {
tmp_1 = -(sqrt(2.0 * (F * ((C + A) - t_1))) / sqrt(t_0));
} else {
tmp_1 = -(pow(-F, 0.5) / sqrt(C));
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
if C < -5.69998603036287621e-108Initial program 50.9
Simplified46.8
Taylor expanded in A around -inf 42.8
Simplified42.8
if -5.69998603036287621e-108 < C < -3.07399569916290406e-304Initial program 45.2
Simplified36.8
Applied associate--l+_binary6436.8
if -3.07399569916290406e-304 < C < 3.0286234536972627e21Initial program 45.7
Simplified42.2
Applied add-sqr-sqrt_binary6442.5
Applied sqrt-prod_binary6434.7
Applied distribute-lft-neg-in_binary6434.7
Applied times-frac_binary6434.6
Simplified34.1
if 3.0286234536972627e21 < C Initial program 61.9
Simplified60.8
Taylor expanded in A around -inf 38.3
Simplified38.3
Applied associate-*r/_binary6438.3
Applied sqrt-div_binary6429.9
Applied associate-*l/_binary6429.9
Applied add-sqr-sqrt_binary6429.9
Applied associate-*r*_binary6429.9
Applied pow1_binary6429.9
Applied sqrt-pow1_binary6429.9
Applied pow1_binary6429.9
Applied sqrt-pow1_binary6429.9
Applied pow1_binary6429.9
Applied pow1_binary6429.9
Applied pow-prod-down_binary6429.9
Applied sqrt-pow1_binary6429.9
Applied pow-prod-down_binary6429.8
Applied pow-prod-down_binary6429.9
Simplified29.8
Final simplification33.6
herbie shell --seed 2022081
(FPCore (A B C F)
:name "ABCF->ab-angle b"
: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))))