\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 := \sqrt{-0.5 \cdot F}\\
t_1 := -t_0 \cdot \sqrt{\frac{2}{C}}\\
\mathbf{if}\;B \leq -5.192355289516512 \cdot 10^{+145}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
t_3 := \sqrt{t_2}\\
t_4 := \sqrt{2 \cdot \left(F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}\\
\mathbf{if}\;B \leq -1.9368627004399634 \cdot 10^{+62}:\\
\;\;\;\;\frac{-t_3}{\frac{t_2}{t_4}}\\
\mathbf{elif}\;B \leq -1.1887020586003648 \cdot 10^{-9}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt{-8 \cdot \left(F \cdot C\right)}\\
t_6 := \sqrt{2} \cdot t_5\\
t_7 := \frac{\mathsf{fma}\left(A, t_6, \frac{F \cdot \left(\left(B \cdot B\right) \cdot \sqrt{2}\right)}{t_5}\right)}{t_2}\\
\mathbf{if}\;B \leq -1.6488967253407525 \cdot 10^{-202}:\\
\;\;\;\;t_7\\
\mathbf{elif}\;B \leq -7.764483043690051 \cdot 10^{-244}:\\
\;\;\;\;\begin{array}{l}
t_8 := \sqrt{\sqrt{C}}\\
-\frac{t_0}{t_8} \cdot \frac{\sqrt{2}}{t_8}
\end{array}\\
\mathbf{elif}\;B \leq 1.808071538330122 \cdot 10^{-259}:\\
\;\;\;\;\frac{A \cdot t_6}{t_2}\\
\mathbf{elif}\;B \leq 1.5834672922955202 \cdot 10^{-160}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \mathsf{fma}\left(2, A, 0.5 \cdot \frac{B \cdot B}{A}\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 1.9689375832376793 \cdot 10^{-100}:\\
\;\;\;\;t_7\\
\mathbf{elif}\;B \leq 3.5954420532414973 \cdot 10^{-12}:\\
\;\;\;\;-\frac{t_4}{t_3}\\
\mathbf{elif}\;B \leq 5.757347306203787 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \frac{\sqrt{2}}{B}\\
\end{array}\\
\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 (sqrt (* -0.5 F))) (t_1 (- (* t_0 (sqrt (/ 2.0 C))))))
(if (<= B -5.192355289516512e+145)
t_1
(let* ((t_2 (fma A (* C -4.0) (* B B)))
(t_3 (sqrt t_2))
(t_4 (sqrt (* 2.0 (* F (- (+ C A) (hypot B (- A C))))))))
(if (<= B -1.9368627004399634e+62)
(/ (- t_3) (/ t_2 t_4))
(if (<= B -1.1887020586003648e-9)
t_1
(let* ((t_5 (sqrt (* -8.0 (* F C))))
(t_6 (* (sqrt 2.0) t_5))
(t_7
(/ (fma A t_6 (/ (* F (* (* B B) (sqrt 2.0))) t_5)) t_2)))
(if (<= B -1.6488967253407525e-202)
t_7
(if (<= B -7.764483043690051e-244)
(let* ((t_8 (sqrt (sqrt C))))
(- (* (/ t_0 t_8) (/ (sqrt 2.0) t_8))))
(if (<= B 1.808071538330122e-259)
(/ (* A t_6) t_2)
(if (<= B 1.5834672922955202e-160)
(/
(-
(sqrt
(*
t_2
(* 2.0 (* F (fma 2.0 A (* 0.5 (/ (* B B) A))))))))
t_2)
(if (<= B 1.9689375832376793e-100)
t_7
(if (<= B 3.5954420532414973e-12)
(- (/ t_4 t_3))
(if (<= B 5.757347306203787e+100)
t_1
(-
(*
(sqrt (* F (- A (hypot A B))))
(/ (sqrt 2.0) 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 = sqrt(-0.5 * F);
double t_1 = -(t_0 * sqrt(2.0 / C));
double tmp;
if (B <= -5.192355289516512e+145) {
tmp = t_1;
} else {
double t_2 = fma(A, (C * -4.0), (B * B));
double t_3 = sqrt(t_2);
double t_4 = sqrt(2.0 * (F * ((C + A) - hypot(B, (A - C)))));
double tmp_1;
if (B <= -1.9368627004399634e+62) {
tmp_1 = -t_3 / (t_2 / t_4);
} else if (B <= -1.1887020586003648e-9) {
tmp_1 = t_1;
} else {
double t_5 = sqrt(-8.0 * (F * C));
double t_6 = sqrt(2.0) * t_5;
double t_7 = fma(A, t_6, ((F * ((B * B) * sqrt(2.0))) / t_5)) / t_2;
double tmp_2;
if (B <= -1.6488967253407525e-202) {
tmp_2 = t_7;
} else if (B <= -7.764483043690051e-244) {
double t_8 = sqrt(sqrt(C));
tmp_2 = -((t_0 / t_8) * (sqrt(2.0) / t_8));
} else if (B <= 1.808071538330122e-259) {
tmp_2 = (A * t_6) / t_2;
} else if (B <= 1.5834672922955202e-160) {
tmp_2 = -sqrt(t_2 * (2.0 * (F * fma(2.0, A, (0.5 * ((B * B) / A)))))) / t_2;
} else if (B <= 1.9689375832376793e-100) {
tmp_2 = t_7;
} else if (B <= 3.5954420532414973e-12) {
tmp_2 = -(t_4 / t_3);
} else if (B <= 5.757347306203787e+100) {
tmp_2 = t_1;
} else {
tmp_2 = -(sqrt(F * (A - hypot(A, B))) * (sqrt(2.0) / B));
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
if B < -5.1923552895165125e145 or -1.9368627004399634e62 < B < -1.1887020586003648e-9 or 3.59544205324149731e-12 < B < 5.7573473062037871e100Initial program 52.9
Simplified50.8
Taylor expanded in A around -inf 50.7
Simplified50.7
Applied associate-*r/_binary6450.7
Applied sqrt-div_binary6446.6
Applied div-inv_binary6446.6
Applied associate-*l*_binary6446.6
Simplified46.6
Applied sqrt-undiv_binary6446.6
if -5.1923552895165125e145 < B < -1.9368627004399634e62Initial program 49.0
Simplified46.1
Applied sqrt-prod_binary6431.5
Applied distribute-lft-neg-in_binary6431.5
Applied associate-/l*_binary6433.4
if -1.1887020586003648e-9 < B < -1.6488967253407525e-202 or 1.5834672922955202e-160 < B < 1.96893758323767929e-100Initial program 49.0
Simplified43.9
Taylor expanded in A around -inf 40.3
Simplified40.3
if -1.6488967253407525e-202 < B < -7.7644830436900508e-244Initial program 52.8
Simplified50.4
Taylor expanded in A around -inf 41.1
Simplified41.1
Applied associate-*r/_binary6441.1
Applied sqrt-div_binary6433.8
Applied div-inv_binary6433.8
Applied associate-*l*_binary6433.8
Simplified33.8
Applied add-sqr-sqrt_binary6433.9
Applied *-un-lft-identity_binary6433.9
Applied sqrt-prod_binary6433.9
Applied times-frac_binary6433.9
Applied associate-*r*_binary6433.9
Simplified33.9
if -7.7644830436900508e-244 < B < 1.8080715383301219e-259Initial program 51.9
Simplified47.0
Taylor expanded in A around -inf 36.1
Simplified36.1
if 1.8080715383301219e-259 < B < 1.5834672922955202e-160Initial program 54.0
Simplified47.8
Taylor expanded in A around -inf 34.0
Simplified34.0
if 1.96893758323767929e-100 < B < 3.59544205324149731e-12Initial program 46.1
Simplified42.4
Applied add-sqr-sqrt_binary6446.6
Applied sqrt-prod_binary6443.0
Applied distribute-lft-neg-in_binary6443.0
Applied times-frac_binary6443.0
Simplified42.8
if 5.7573473062037871e100 < B Initial program 60.5
Simplified60.0
Taylor expanded in C around 0 56.9
Simplified30.6
Final simplification39.0
herbie shell --seed 2022082
(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))))