\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{F \cdot -0.5}\\
t_1 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\
\mathbf{if}\;t_2 \leq -4.648998873024837 \cdot 10^{+268}:\\
\;\;\;\;-t_0 \cdot \frac{\sqrt{2}}{\sqrt{C}}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
\mathbf{if}\;t_2 \leq -2.3548208496446757 \cdot 10^{-215}:\\
\;\;\;\;\frac{-\sqrt{t_3 \cdot \left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)\right)}}{t_3}\\
\mathbf{elif}\;t_2 \leq 4.459076428910567 \cdot 10^{+192}:\\
\;\;\;\;\frac{-\sqrt{t_3 \cdot \left(2 \cdot \left(F \cdot \mathsf{fma}\left(2, A, -0.5 \cdot \frac{B \cdot B}{C}\right)\right)\right)}}{t_3}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(C \cdot F\right)}\right)}{t_3}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt{\sqrt{2}}\\
-\frac{t_0}{\sqrt{C}} \cdot \left(t_4 \cdot t_4\right)
\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 (* F -0.5)))
(t_1 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_2
(/
(-
(sqrt
(*
(* 2.0 (* t_1 F))
(- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_1)))
(if (<= t_2 -4.648998873024837e+268)
(- (* t_0 (/ (sqrt 2.0) (sqrt C))))
(let* ((t_3 (fma A (* C -4.0) (* B B))))
(if (<= t_2 -2.3548208496446757e-215)
(/ (- (sqrt (* t_3 (* 2.0 (* F (- A (hypot A B))))))) t_3)
(if (<= t_2 4.459076428910567e+192)
(/
(- (sqrt (* t_3 (* 2.0 (* F (fma 2.0 A (* -0.5 (/ (* B B) C))))))))
t_3)
(if (<= t_2 INFINITY)
(/ (* A (* (sqrt 2.0) (sqrt (* -8.0 (* C F))))) t_3)
(let* ((t_4 (sqrt (sqrt 2.0))))
(- (* (/ t_0 (sqrt C)) (* t_4 t_4)))))))))))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(F * -0.5);
double t_1 = pow(B, 2.0) - ((4.0 * A) * C);
double t_2 = -sqrt((2.0 * (t_1 * F)) * ((A + C) - sqrt(pow(B, 2.0) + pow((A - C), 2.0)))) / t_1;
double tmp;
if (t_2 <= -4.648998873024837e+268) {
tmp = -(t_0 * (sqrt(2.0) / sqrt(C)));
} else {
double t_3 = fma(A, (C * -4.0), (B * B));
double tmp_1;
if (t_2 <= -2.3548208496446757e-215) {
tmp_1 = -sqrt(t_3 * (2.0 * (F * (A - hypot(A, B))))) / t_3;
} else if (t_2 <= 4.459076428910567e+192) {
tmp_1 = -sqrt(t_3 * (2.0 * (F * fma(2.0, A, (-0.5 * ((B * B) / C)))))) / t_3;
} else if (t_2 <= ((double) INFINITY)) {
tmp_1 = (A * (sqrt(2.0) * sqrt(-8.0 * (C * F)))) / t_3;
} else {
double t_4 = sqrt(sqrt(2.0));
tmp_1 = -((t_0 / sqrt(C)) * (t_4 * t_4));
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -4.64899887302483691e268Initial program 61.8
Simplified53.4
Taylor expanded in A around -inf 34.6
Simplified34.6
Applied associate-*r/_binary6434.6
Applied sqrt-div_binary6423.2
Applied div-inv_binary6423.3
Applied associate-*l*_binary6423.3
Simplified23.2
if -4.64899887302483691e268 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -2.3548208496446757e-215Initial program 1.5
Simplified2.0
Taylor expanded in C around 0 2.8
Simplified2.8
if -2.3548208496446757e-215 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 4.4590764289105669e192Initial program 50.9
Simplified49.3
Taylor expanded in C around inf 23.6
Simplified23.6
if 4.4590764289105669e192 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 57.0
Simplified39.8
Taylor expanded in A around -inf 16.3
Simplified16.3
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 64.0
Simplified63.5
Taylor expanded in A around -inf 52.6
Simplified52.6
Applied associate-*r/_binary6452.6
Applied sqrt-div_binary6448.8
Applied add-sqr-sqrt_binary6448.8
Applied associate-*r*_binary6448.8
Applied associate-*l*_binary6448.8
Final simplification30.8
herbie shell --seed 2022068
(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))))