\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 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_0}\\
t_2 := \sqrt{-F}\\
\mathbf{if}\;t_1 \leq -2.52337341989472 \cdot 10^{+196}:\\
\;\;\;\;\frac{-1}{\frac{\sqrt{C}}{t_2}}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
\mathbf{if}\;t_1 \leq -5.110582906115813 \cdot 10^{-196}:\\
\;\;\;\;\begin{array}{l}
t_4 := F \cdot \left(B \cdot B\right)\\
t_5 := C \cdot t_4\\
\frac{-\sqrt{\mathsf{fma}\left(2, \left(A \cdot t_5\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(A, A, B \cdot B\right)}}, \mathsf{fma}\left(2, t_5, \mathsf{fma}\left(2, A \cdot t_4, 8 \cdot \left(\left(A \cdot \left(C \cdot F\right)\right) \cdot \mathsf{hypot}\left(A, B\right)\right)\right)\right)\right) - \mathsf{fma}\left(8, \left(C \cdot F\right) \cdot \left(A \cdot A\right), 2 \cdot \left(t_4 \cdot \mathsf{hypot}\left(A, B\right)\right)\right)}}{t_3}
\end{array}\\
\mathbf{elif}\;t_1 \leq 3.1080744412656145 \cdot 10^{+66}:\\
\;\;\;\;\frac{-\sqrt{t_3 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A - 0.5 \cdot \frac{{B}^{2}}{C}\right)\right)\right)}}{t_3}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\begin{array}{l}
t_6 := \sqrt{\left(C \cdot F\right) \cdot -8}\\
\frac{A \cdot \left(\sqrt{2} \cdot t_6\right) + \frac{F \cdot \left({B}^{2} \cdot \sqrt{2}\right)}{t_6}}{t_3}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;-\frac{t_2}{\sqrt{C}}\\
\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 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_1
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_0))
(t_2 (sqrt (- F))))
(if (<= t_1 -2.52337341989472e+196)
(/ -1.0 (/ (sqrt C) t_2))
(let* ((t_3 (fma A (* C -4.0) (* B B))))
(if (<= t_1 -5.110582906115813e-196)
(let* ((t_4 (* F (* B B))) (t_5 (* C t_4)))
(/
(-
(sqrt
(-
(fma
2.0
(* (* A t_5) (sqrt (/ 1.0 (fma A A (* B B)))))
(fma
2.0
t_5
(fma 2.0 (* A t_4) (* 8.0 (* (* A (* C F)) (hypot A B))))))
(fma 8.0 (* (* C F) (* A A)) (* 2.0 (* t_4 (hypot A B)))))))
t_3))
(if (<= t_1 3.1080744412656145e+66)
(/
(-
(sqrt
(* t_3 (* 2.0 (* F (- (* 2.0 A) (* 0.5 (/ (pow B 2.0) C))))))))
t_3)
(if (<= t_1 INFINITY)
(let* ((t_6 (sqrt (* (* C F) -8.0))))
(/
(+
(* A (* (sqrt 2.0) t_6))
(/ (* F (* (pow B 2.0) (sqrt 2.0))) t_6))
t_3))
(- (/ t_2 (sqrt 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 = pow(B, 2.0) - ((4.0 * A) * C);
double t_1 = -sqrt((2.0 * (t_0 * F)) * ((A + C) - sqrt(pow(B, 2.0) + pow((A - C), 2.0)))) / t_0;
double t_2 = sqrt(-F);
double tmp;
if (t_1 <= -2.52337341989472e+196) {
tmp = -1.0 / (sqrt(C) / t_2);
} else {
double t_3 = fma(A, (C * -4.0), (B * B));
double tmp_1;
if (t_1 <= -5.110582906115813e-196) {
double t_4_2 = F * (B * B);
double t_5_3 = C * t_4_2;
tmp_1 = -sqrt(fma(2.0, ((A * t_5_3) * sqrt(1.0 / fma(A, A, (B * B)))), fma(2.0, t_5_3, fma(2.0, (A * t_4_2), (8.0 * ((A * (C * F)) * hypot(A, B)))))) - fma(8.0, ((C * F) * (A * A)), (2.0 * (t_4_2 * hypot(A, B))))) / t_3;
} else if (t_1 <= 3.1080744412656145e+66) {
tmp_1 = -sqrt(t_3 * (2.0 * (F * ((2.0 * A) - (0.5 * (pow(B, 2.0) / C)))))) / t_3;
} else if (t_1 <= ((double) INFINITY)) {
double t_6 = sqrt((C * F) * -8.0);
tmp_1 = ((A * (sqrt(2.0) * t_6)) + ((F * (pow(B, 2.0) * sqrt(2.0))) / t_6)) / t_3;
} else {
tmp_1 = -(t_2 / sqrt(C));
}
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))) < -2.52337341989472001e196Initial program 61.9
Simplified53.6
Taylor expanded in A around -inf 33.7
Simplified33.7
Applied associate-*r/_binary6433.7
Applied sqrt-div_binary6422.1
Applied associate-*l/_binary6422.1
Applied sqrt-unprod_binary6421.9
Simplified21.9
Applied *-un-lft-identity_binary6421.9
Applied sqrt-prod_binary6421.9
Applied associate-/l*_binary6422.0
if -2.52337341989472001e196 < (/.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))) < -5.1105829061158132e-196Initial program 1.4
Simplified1.5
Taylor expanded in C around 0 3.5
Simplified3.5
if -5.1105829061158132e-196 < (/.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))) < 3.10807444126561446e66Initial program 53.6
Simplified52.4
Taylor expanded in C around inf 26.6
if 3.10807444126561446e66 < (/.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 50.2
Simplified35.3
Taylor expanded in A around -inf 15.5
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 53.3
Simplified53.3
Applied associate-*r/_binary6453.3
Applied sqrt-div_binary6449.7
Applied associate-*l/_binary6449.7
Applied sqrt-unprod_binary6449.7
Simplified49.7
Final simplification31.5
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))))