\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}
\mathbf{if}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -\infty:\\
\;\;\;\;\frac{-1}{\frac{B \cdot B - \left(4 \cdot A\right) \cdot C}{\sqrt{A \cdot \left(4 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)\right)}}}\\
\mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -2.291700553487221 \cdot 10^{-210}:\\
\;\;\;\;\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{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}} \cdot \sqrt{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{A \cdot \left(4 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)\right)}}{\left(4 \cdot A\right) \cdot C - B \cdot B}\\
\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
(if (<=
(/
(-
(sqrt
(*
(* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
(- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
(- (pow B 2.0) (* (* 4.0 A) C)))
(- INFINITY))
(/
-1.0
(/
(- (* B B) (* (* 4.0 A) C))
(sqrt (* A (* 4.0 (* F (- (* B B) (* (* 4.0 A) C))))))))
(if (<=
(/
(-
(sqrt
(*
(* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
(- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
(- (pow B 2.0) (* (* 4.0 A) C)))
-2.291700553487221e-210)
(/
(-
(sqrt
(*
(* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
(-
(+ A C)
(*
(sqrt (sqrt (+ (pow (- A C) 2.0) (* B B))))
(sqrt (sqrt (+ (pow (- A C) 2.0) (* B B)))))))))
(- (pow B 2.0) (* (* 4.0 A) C)))
(/
(sqrt (* A (* 4.0 (* F (- (* B B) (* (* 4.0 A) C))))))
(- (* (* 4.0 A) C) (* B 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 tmp;
if ((-sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) - sqrt(pow(B, 2.0) + pow((A - C), 2.0)))) / (pow(B, 2.0) - ((4.0 * A) * C))) <= -((double) INFINITY)) {
tmp = -1.0 / (((B * B) - ((4.0 * A) * C)) / sqrt(A * (4.0 * (F * ((B * B) - ((4.0 * A) * C))))));
} else if ((-sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) - sqrt(pow(B, 2.0) + pow((A - C), 2.0)))) / (pow(B, 2.0) - ((4.0 * A) * C))) <= -2.291700553487221e-210) {
tmp = -sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) - (sqrt(sqrt(pow((A - C), 2.0) + (B * B))) * sqrt(sqrt(pow((A - C), 2.0) + (B * B)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
} else {
tmp = sqrt(A * (4.0 * (F * ((B * B) - ((4.0 * A) * C))))) / (((4.0 * A) * C) - (B * B));
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
Results
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))) < -inf.0Initial program 64.0
rmApplied associate--l+_binary64_342564.0
Applied distribute-rgt-in_binary64_343864.0
Simplified64.0
Simplified64.0
Taylor expanded around -inf 53.0
rmApplied add-sqr-sqrt_binary64_351053.0
Simplified52.9
Simplified45.7
rmApplied neg-mul-1_binary64_348445.7
Applied associate-/l*_binary64_343345.7
Simplified45.6
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))) < -2.29170055348722083e-210Initial program 1.6
rmApplied add-sqr-sqrt_binary64_35101.7
Simplified1.7
Simplified1.7
if -2.29170055348722083e-210 < (/.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 60.1
rmApplied associate--l+_binary64_342559.2
Applied distribute-rgt-in_binary64_343859.2
Simplified59.2
Simplified59.2
Taylor expanded around -inf 56.8
rmApplied add-sqr-sqrt_binary64_351056.9
Simplified56.7
Simplified50.3
rmApplied frac-2neg_binary64_349950.3
Simplified50.3
Simplified50.3
Final simplification42.3
herbie shell --seed 2020358
(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))))