\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{2 \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)}\\
\mathbf{if}\;B \leq -1.5180475354614873 \cdot 10^{+53}:\\
\;\;\;\;-\frac{t_0}{-B}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
\mathbf{if}\;B \leq -1.6993691026398643 \cdot 10^{-24}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot C - 0.5 \cdot \frac{{B}^{2}}{A}\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \sqrt{t_1}\\
t_3 := \frac{-t_0}{t_2}\\
t_4 := -t_0\\
\mathbf{if}\;B \leq -5.281598276878717 \cdot 10^{-147}:\\
\;\;\;\;\frac{t_2}{t_2} \cdot t_3\\
\mathbf{elif}\;B \leq -5.219385286668219 \cdot 10^{-272}:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt{-8 \cdot \left(F \cdot A\right)}\\
\frac{-\mathsf{fma}\left(t_5, C \cdot \sqrt{2}, \frac{F \cdot \left(\left(B \cdot B\right) \cdot \sqrt{2}\right)}{t_5}\right)}{t_1}
\end{array}\\
\mathbf{elif}\;B \leq -3.853481712582081 \cdot 10^{-298}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A - 0.5 \cdot \frac{{B}^{2}}{C}\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 2.0497063361135274 \cdot 10^{-260}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot \mathsf{fma}\left(0.5, \frac{B \cdot B}{C}, 2 \cdot C\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 1.264548681151659 \cdot 10^{-128}:\\
\;\;\;\;-\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}\\
\mathbf{elif}\;B \leq 9.192513924446474 \cdot 10^{-33}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{t_4}{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 (* 2.0 (* F (+ (+ A C) (hypot B (- A C))))))))
(if (<= B -1.5180475354614873e+53)
(- (/ t_0 (- B)))
(let* ((t_1 (fma A (* C -4.0) (* B B))))
(if (<= B -1.6993691026398643e-24)
(/
(-
(sqrt
(* t_1 (* 2.0 (* F (- (* 2.0 C) (* 0.5 (/ (pow B 2.0) A))))))))
t_1)
(let* ((t_2 (sqrt t_1)) (t_3 (/ (- t_0) t_2)) (t_4 (- t_0)))
(if (<= B -5.281598276878717e-147)
(* (/ t_2 t_2) t_3)
(if (<= B -5.219385286668219e-272)
(let* ((t_5 (sqrt (* -8.0 (* F A)))))
(/
(-
(fma
t_5
(* C (sqrt 2.0))
(/ (* F (* (* B B) (sqrt 2.0))) t_5)))
t_1))
(if (<= B -3.853481712582081e-298)
(/
(-
(sqrt
(*
t_1
(* 2.0 (* F (- (* 2.0 A) (* 0.5 (/ (pow B 2.0) C))))))))
t_1)
(if (<= B 2.0497063361135274e-260)
(/
(-
(sqrt
(* t_1 (* 2.0 (* F (fma 0.5 (/ (* B B) C) (* 2.0 C)))))))
t_1)
(if (<= B 1.264548681151659e-128)
(- (* (sqrt 2.0) (sqrt (* -0.5 (/ F A)))))
(if (<= B 9.192513924446474e-33) t_3 (/ t_4 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(2.0 * (F * ((A + C) + hypot(B, (A - C)))));
double tmp;
if (B <= -1.5180475354614873e+53) {
tmp = -(t_0 / -B);
} else {
double t_1 = fma(A, (C * -4.0), (B * B));
double tmp_1;
if (B <= -1.6993691026398643e-24) {
tmp_1 = -sqrt(t_1 * (2.0 * (F * ((2.0 * C) - (0.5 * (pow(B, 2.0) / A)))))) / t_1;
} else {
double t_2 = sqrt(t_1);
double t_3 = -t_0 / t_2;
double t_4 = -t_0;
double tmp_2;
if (B <= -5.281598276878717e-147) {
tmp_2 = (t_2 / t_2) * t_3;
} else if (B <= -5.219385286668219e-272) {
double t_5 = sqrt(-8.0 * (F * A));
tmp_2 = -fma(t_5, (C * sqrt(2.0)), ((F * ((B * B) * sqrt(2.0))) / t_5)) / t_1;
} else if (B <= -3.853481712582081e-298) {
tmp_2 = -sqrt(t_1 * (2.0 * (F * ((2.0 * A) - (0.5 * (pow(B, 2.0) / C)))))) / t_1;
} else if (B <= 2.0497063361135274e-260) {
tmp_2 = -sqrt(t_1 * (2.0 * (F * fma(0.5, ((B * B) / C), (2.0 * C))))) / t_1;
} else if (B <= 1.264548681151659e-128) {
tmp_2 = -(sqrt(2.0) * sqrt(-0.5 * (F / A)));
} else if (B <= 9.192513924446474e-33) {
tmp_2 = t_3;
} else {
tmp_2 = t_4 / 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 < -1.5180475354614873e53Initial program 57.7
Simplified56.3
Applied add-sqr-sqrt_binary6456.5
Applied sqrt-prod_binary6450.3
Applied distribute-lft-neg-in_binary6450.3
Applied times-frac_binary6450.3
Simplified48.9
Taylor expanded in B around -inf 29.8
if -1.5180475354614873e53 < B < -1.6993691026398643e-24Initial program 39.3
Simplified35.9
Taylor expanded in A around -inf 54.5
if -1.6993691026398643e-24 < B < -5.28159827687871672e-147Initial program 47.2
Simplified42.3
Applied add-sqr-sqrt_binary6447.7
Applied sqrt-prod_binary6443.8
Applied distribute-rgt-neg-in_binary6443.8
Applied times-frac_binary6443.7
if -5.28159827687871672e-147 < B < -5.2193852866682191e-272Initial program 53.8
Simplified48.7
Taylor expanded in C around inf 51.6
Simplified51.6
if -5.2193852866682191e-272 < B < -3.85348171258208062e-298Initial program 52.1
Simplified47.6
Taylor expanded in C around -inf 46.5
if -3.85348171258208062e-298 < B < 2.04970633611352736e-260Initial program 53.6
Simplified48.5
Taylor expanded in C around inf 50.1
Simplified50.1
if 2.04970633611352736e-260 < B < 1.26454868115165894e-128Initial program 52.2
Simplified47.6
Taylor expanded in C around inf 49.3
Simplified49.3
if 1.26454868115165894e-128 < B < 9.19251392444647417e-33Initial program 48.5
Simplified43.8
Applied add-sqr-sqrt_binary6449.1
Applied sqrt-prod_binary6443.8
Applied distribute-lft-neg-in_binary6443.8
Applied times-frac_binary6443.7
Simplified43.6
if 9.19251392444647417e-33 < B Initial program 54.2
Simplified52.2
Applied add-sqr-sqrt_binary6453.0
Applied sqrt-prod_binary6447.3
Applied distribute-lft-neg-in_binary6447.3
Applied times-frac_binary6447.3
Simplified46.2
Taylor expanded in A around 0 32.5
Final simplification40.2
herbie shell --seed 2021340
(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))))