\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{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \left(\sqrt[3]{\sqrt{2}} \cdot \sqrt{F \cdot -0.5}\right)}{\sqrt{C}}\\
\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.436086178660204 \cdot 10^{-175}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \left(2 \cdot \left(F \cdot \left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\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 0:\\
\;\;\;\;-\sqrt{\sqrt{-F}} \cdot \frac{\sqrt{\sqrt{-F}}}{\sqrt{C}}\\
\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 \infty:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(C \cdot F\right)} \cdot \left(A \cdot \sqrt{2}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{\sqrt{C}}{\sqrt{-F}}}\\
\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))
(-
(/
(*
(* (cbrt (sqrt 2.0)) (cbrt (sqrt 2.0)))
(* (cbrt (sqrt 2.0)) (sqrt (* F -0.5))))
(sqrt 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.436086178660204e-175)
(/
(-
(sqrt
(*
(- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))
(* 2.0 (* F (- (* B B) (* 4.0 (* A C))))))))
(- (pow B 2.0) (* (* 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)))
0.0)
(- (* (sqrt (sqrt (- F))) (/ (sqrt (sqrt (- F))) (sqrt 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)))
INFINITY)
(/
(* (sqrt (* -8.0 (* C F))) (* A (sqrt 2.0)))
(- (pow B 2.0) (* (* 4.0 A) C)))
(/ -1.0 (/ (sqrt C) (sqrt (- F)))))))))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 = -(((cbrt(sqrt(2.0)) * cbrt(sqrt(2.0))) * (cbrt(sqrt(2.0)) * sqrt(F * -0.5))) / sqrt(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.436086178660204e-175) {
tmp = -sqrt(((A + C) - sqrt(pow(B, 2.0) + pow((A - C), 2.0))) * (2.0 * (F * ((B * B) - (4.0 * (A * C)))))) / (pow(B, 2.0) - ((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))) <= 0.0) {
tmp = -(sqrt(sqrt(-F)) * (sqrt(sqrt(-F)) / sqrt(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))) <= ((double) INFINITY)) {
tmp = (sqrt(-8.0 * (C * F)) * (A * sqrt(2.0))) / (pow(B, 2.0) - ((4.0 * A) * C));
} else {
tmp = -1.0 / (sqrt(C) / sqrt(-F));
}
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
Taylor expanded around -inf 33.8
Simplified33.8
rmApplied associate-*r/_binary6433.8
Applied sqrt-div_binary6422.7
Applied associate-*r/_binary6422.7
Simplified22.7
rmApplied add-cube-cbrt_binary6422.7
Applied associate-*l*_binary6422.7
Simplified22.7
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.43608617866020407e-175Initial program 1.5
rmApplied *-un-lft-identity_binary641.5
Applied associate-*r*_binary641.5
Simplified1.5
if -2.43608617866020407e-175 < (/.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))) < 0.0Initial program 57.7
Taylor expanded around -inf 34.7
Simplified34.7
rmApplied associate-*r/_binary6434.7
Applied sqrt-div_binary6430.4
Applied associate-*r/_binary6430.4
Simplified30.4
rmApplied sqrt-unprod_binary6430.4
Simplified30.4
rmApplied *-un-lft-identity_binary6430.4
Applied add-sqr-sqrt_binary6430.5
Applied times-frac_binary6430.5
if 0.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))) < +inf.0Initial program 36.2
Taylor expanded around -inf 13.8
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
Taylor expanded around -inf 51.8
Simplified51.8
rmApplied associate-*r/_binary6451.8
Applied sqrt-div_binary6447.8
Applied associate-*r/_binary6447.8
Simplified47.8
rmApplied sqrt-unprod_binary6447.8
Simplified47.8
rmApplied *-un-lft-identity_binary6447.8
Applied sqrt-prod_binary6447.8
Applied associate-/l*_binary6447.8
Final simplification30.8
herbie shell --seed 2021173
(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))))