\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}\;A \leq -3.277008247238346 \cdot 10^{+104}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(2 \cdot \left(F \cdot \left(C \cdot 2 - 0.5 \cdot \frac{{B}^{2}}{A}\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;A \leq -3.3733636712735783 \cdot 10^{-6}:\\
\;\;\;\;-\frac{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \sqrt{2}}{\sqrt{t_0}}\\
\mathbf{elif}\;A \leq -1.9912769568690773 \cdot 10^{-116}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{t_0}\\
\mathbf{elif}\;A \leq 2.278138602698376 \cdot 10^{-123}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{\mathsf{hypot}\left(\sqrt{A \cdot \left(C \cdot -4\right)}, B\right)}\\
-\frac{\sqrt{2 \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_1 \cdot t_1}
\end{array}\\
\mathbf{elif}\;A \leq 1.3878956288245037 \cdot 10^{+33}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(2 \cdot \left(F \cdot \left(A + \sqrt{{B}^{2} + {A}^{2}}\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;A \leq 3.5282074295653997 \cdot 10^{+190}:\\
\;\;\;\;\frac{-A \cdot \left(\sqrt{2} \cdot \sqrt{\left(C \cdot F\right) \cdot -8}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{C}}\\
\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 (<= A -3.277008247238346e+104)
(/
(- (sqrt (* t_0 (* 2.0 (* F (- (* C 2.0) (* 0.5 (/ (pow B 2.0) A))))))))
t_0)
(if (<= A -3.3733636712735783e-6)
(- (/ (* (sqrt (* F (+ C (hypot B C)))) (sqrt 2.0)) (sqrt t_0)))
(if (<= A -1.9912769568690773e-116)
(/ (- (sqrt (* -16.0 (* (pow A 2.0) (* C F))))) t_0)
(if (<= A 2.278138602698376e-123)
(let* ((t_1 (sqrt (hypot (sqrt (* A (* C -4.0))) B))))
(-
(/
(sqrt (* 2.0 (* F (+ A (+ C (hypot B (- A C)))))))
(* t_1 t_1))))
(if (<= A 1.3878956288245037e+33)
(/
(-
(sqrt
(*
t_0
(* 2.0 (* F (+ A (sqrt (+ (pow B 2.0) (pow A 2.0)))))))))
t_0)
(if (<= A 3.5282074295653997e+190)
(/ (- (* A (* (sqrt 2.0) (sqrt (* (* C F) -8.0))))) t_0)
(- (* (sqrt 2.0) (sqrt (* -0.5 (/ F 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 (A <= -3.277008247238346e+104) {
tmp = -sqrt(t_0 * (2.0 * (F * ((C * 2.0) - (0.5 * (pow(B, 2.0) / A)))))) / t_0;
} else if (A <= -3.3733636712735783e-6) {
tmp = -((sqrt(F * (C + hypot(B, C))) * sqrt(2.0)) / sqrt(t_0));
} else if (A <= -1.9912769568690773e-116) {
tmp = -sqrt(-16.0 * (pow(A, 2.0) * (C * F))) / t_0;
} else if (A <= 2.278138602698376e-123) {
double t_1 = sqrt(hypot(sqrt(A * (C * -4.0)), B));
tmp = -(sqrt(2.0 * (F * (A + (C + hypot(B, (A - C)))))) / (t_1 * t_1));
} else if (A <= 1.3878956288245037e+33) {
tmp = -sqrt(t_0 * (2.0 * (F * (A + sqrt(pow(B, 2.0) + pow(A, 2.0)))))) / t_0;
} else if (A <= 3.5282074295653997e+190) {
tmp = -(A * (sqrt(2.0) * sqrt((C * F) * -8.0))) / t_0;
} else {
tmp = -(sqrt(2.0) * sqrt(-0.5 * (F / C)));
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
if A < -3.27700824723834617e104Initial program 63.2
Simplified62.2
Taylor expanded in A around -inf 43.8
if -3.27700824723834617e104 < A < -3.3733636712735783e-6Initial program 56.8
Simplified55.2
Applied add-sqr-sqrt_binary6456.1
Applied sqrt-prod_binary6451.4
Applied distribute-lft-neg-in_binary6451.4
Applied times-frac_binary6451.4
Simplified50.8
Taylor expanded in A around 0 50.5
Simplified46.9
if -3.3733636712735783e-6 < A < -1.99127695686907734e-116Initial program 51.4
Simplified48.8
Taylor expanded in A around inf 54.9
if -1.99127695686907734e-116 < A < 2.27813860269837597e-123Initial program 48.7
Simplified45.7
Applied add-sqr-sqrt_binary6449.1
Applied sqrt-prod_binary6443.6
Applied distribute-lft-neg-in_binary6443.6
Applied times-frac_binary6443.6
Simplified43.0
Applied add-sqr-sqrt_binary6443.1
Simplified47.9
Simplified41.0
Applied associate-+l+_binary6440.4
if 2.27813860269837597e-123 < A < 1.38789562882450369e33Initial program 42.4
Simplified40.7
Taylor expanded in C around 0 40.4
if 1.38789562882450369e33 < A < 3.5282074295653997e190Initial program 45.6
Simplified40.8
Taylor expanded in A around inf 41.6
if 3.5282074295653997e190 < A Initial program 64.0
Simplified53.7
Taylor expanded in A around inf 44.2
Simplified44.2
Final simplification43.3
herbie shell --seed 2022005
(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))))