\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 -2.1809907538999357 \cdot 10^{-29}:\\
\;\;\;\;-\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 -7.450543718790283 \cdot 10^{-121}:\\
\;\;\;\;\begin{array}{l}
t_2 := \sqrt{\left(A \cdot A + \left(B \cdot B + C \cdot C\right)\right) - 2 \cdot \left(A \cdot C\right)}\\
\frac{-\sqrt{F \cdot \left(\mathsf{fma}\left(2, C \cdot \left(B \cdot B\right), 2 \cdot \left(\left(B \cdot B\right) \cdot t_2 + A \cdot \left(B \cdot B\right)\right)\right) - \mathsf{fma}\left(8, C \cdot \left(A \cdot A\right), 8 \cdot \left(A \cdot \left(C \cdot C\right) + \left(A \cdot C\right) \cdot t_2\right)\right)\right)}}{t_1}
\end{array}\\
\mathbf{elif}\;B \leq -1.3918271591250041 \cdot 10^{-139}:\\
\;\;\;\;-\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}\\
\mathbf{elif}\;B \leq -7.195204907113419 \cdot 10^{-174}:\\
\;\;\;\;\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{elif}\;B \leq 2.478409119982122 \cdot 10^{-220}:\\
\;\;\;\;\frac{-A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(F \cdot C\right)}\right)}{t_1}\\
\mathbf{elif}\;B \leq 1.310184971611859 \cdot 10^{-166}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt{\mathsf{hypot}\left(\sqrt{A \cdot \left(C \cdot -4\right)}, B\right)}\\
-\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_3 \cdot t_3}
\end{array}\\
\mathbf{elif}\;B \leq 2.852086878622813 \cdot 10^{-23}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{t_0}{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 (sqrt (* 2.0 (* F (+ (+ A C) (hypot B (- A C))))))))
(if (<= B -2.1809907538999357e-29)
(- (/ t_0 (- B)))
(let* ((t_1 (fma A (* C -4.0) (* B B))))
(if (<= B -7.450543718790283e-121)
(let* ((t_2
(sqrt (- (+ (* A A) (+ (* B B) (* C C))) (* 2.0 (* A C))))))
(/
(-
(sqrt
(*
F
(-
(fma
2.0
(* C (* B B))
(* 2.0 (+ (* (* B B) t_2) (* A (* B B)))))
(fma
8.0
(* C (* A A))
(* 8.0 (+ (* A (* C C)) (* (* A C) t_2))))))))
t_1))
(if (<= B -1.3918271591250041e-139)
(- (* (sqrt 2.0) (sqrt (* -0.5 (/ F A)))))
(if (<= B -7.195204907113419e-174)
(/
(-
(sqrt
(* t_1 (* 2.0 (* F (- (* 2.0 C) (* 0.5 (/ (pow B 2.0) A))))))))
t_1)
(if (<= B 2.478409119982122e-220)
(/ (- (* A (* (sqrt 2.0) (sqrt (* -8.0 (* F C)))))) t_1)
(if (<= B 1.310184971611859e-166)
(let* ((t_3 (sqrt (hypot (sqrt (* A (* C -4.0))) B))))
(-
(/
(* (sqrt 2.0) (sqrt (* F (+ C (hypot B C)))))
(* t_3 t_3))))
(if (<= B 2.852086878622813e-23)
(/ (- (sqrt (* t_1 (* 2.0 (* F (* 2.0 A)))))) t_1)
(- (/ t_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(2.0 * (F * ((A + C) + hypot(B, (A - C)))));
double tmp;
if (B <= -2.1809907538999357e-29) {
tmp = -(t_0 / -B);
} else {
double t_1 = fma(A, (C * -4.0), (B * B));
double tmp_1;
if (B <= -7.450543718790283e-121) {
double t_2_2 = sqrt(((A * A) + ((B * B) + (C * C))) - (2.0 * (A * C)));
tmp_1 = -sqrt(F * (fma(2.0, (C * (B * B)), (2.0 * (((B * B) * t_2_2) + (A * (B * B))))) - fma(8.0, (C * (A * A)), (8.0 * ((A * (C * C)) + ((A * C) * t_2_2)))))) / t_1;
} else if (B <= -1.3918271591250041e-139) {
tmp_1 = -(sqrt(2.0) * sqrt(-0.5 * (F / A)));
} else if (B <= -7.195204907113419e-174) {
tmp_1 = -sqrt(t_1 * (2.0 * (F * ((2.0 * C) - (0.5 * (pow(B, 2.0) / A)))))) / t_1;
} else if (B <= 2.478409119982122e-220) {
tmp_1 = -(A * (sqrt(2.0) * sqrt(-8.0 * (F * C)))) / t_1;
} else if (B <= 1.310184971611859e-166) {
double t_3 = sqrt(hypot(sqrt(A * (C * -4.0)), B));
tmp_1 = -((sqrt(2.0) * sqrt(F * (C + hypot(B, C)))) / (t_3 * t_3));
} else if (B <= 2.852086878622813e-23) {
tmp_1 = -sqrt(t_1 * (2.0 * (F * (2.0 * A)))) / t_1;
} else {
tmp_1 = -(t_0 / B);
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
if B < -2.1809907538999357e-29Initial program 52.8
Simplified50.8
Applied add-sqr-sqrt_binary6451.6
Applied sqrt-prod_binary6446.1
Applied distribute-lft-neg-in_binary6446.1
Applied times-frac_binary6446.1
Simplified45.1
Taylor expanded in B around -inf 31.8
Simplified31.8
if -2.1809907538999357e-29 < B < -7.4505437187902831e-121Initial program 45.2
Simplified40.0
Taylor expanded in F around 0 44.9
Simplified44.9
if -7.4505437187902831e-121 < B < -1.39182715912500414e-139Initial program 49.7
Simplified45.7
Taylor expanded in C around inf 51.7
Simplified51.7
if -1.39182715912500414e-139 < B < -7.19520490711341923e-174Initial program 51.5
Simplified47.1
Taylor expanded in A around -inf 45.7
if -7.19520490711341923e-174 < B < 2.47840911998212199e-220Initial program 53.2
Simplified48.2
Taylor expanded in A around inf 49.3
if 2.47840911998212199e-220 < B < 1.31018497161185898e-166Initial program 56.0
Simplified50.6
Applied add-sqr-sqrt_binary6457.2
Applied sqrt-prod_binary6454.2
Applied distribute-lft-neg-in_binary6454.2
Applied times-frac_binary6454.2
Simplified54.0
Applied add-sqr-sqrt_binary6454.1
Simplified54.1
Simplified52.6
Taylor expanded in A around 0 55.8
Simplified52.9
if 1.31018497161185898e-166 < B < 2.85208687862281319e-23Initial program 48.1
Simplified43.2
Taylor expanded in A around inf 48.9
if 2.85208687862281319e-23 < B Initial program 53.9
Simplified51.9
Applied add-sqr-sqrt_binary6452.9
Applied sqrt-prod_binary6447.6
Applied distribute-lft-neg-in_binary6447.6
Applied times-frac_binary6447.5
Simplified46.5
Taylor expanded in A around 0 33.6
Final simplification40.2
herbie shell --seed 2022067
(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))))