\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 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
\mathbf{if}\;C \leq -9.383027144283094 \cdot 10^{-186}:\\
\;\;\;\;-0.25 \cdot \frac{\sqrt{C \cdot -16} \cdot \sqrt{F}}{C}\\
\mathbf{elif}\;C \leq 2.874342306042804 \cdot 10^{-58}:\\
\;\;\;\;\frac{-\sqrt{t_0} \cdot \sqrt{2 \cdot \left(F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 9.739838238220798 \cdot 10^{+53}:\\
\;\;\;\;-0.25 \cdot \left(\frac{1}{C} \cdot \sqrt{-16 \cdot \left(C \cdot F\right)}\right)\\
\mathbf{elif}\;C \leq 8.229399684641769 \cdot 10^{+106}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(2 \cdot \left(F \cdot \mathsf{fma}\left(A, 2, -0.5 \cdot \frac{B \cdot B}{C}\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \frac{{\left(e^{0.25 \cdot \left(\log C + \log \left(-16 \cdot F\right)\right)}\right)}^{2}}{C}\\
\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 (fma A (* C -4.0) (* B B))))
(if (<= C -9.383027144283094e-186)
(* -0.25 (/ (* (sqrt (* C -16.0)) (sqrt F)) C))
(if (<= C 2.874342306042804e-58)
(/
(- (* (sqrt t_0) (sqrt (* 2.0 (* F (- (+ C A) (hypot B (- A C))))))))
t_0)
(if (<= C 9.739838238220798e+53)
(* -0.25 (* (/ 1.0 C) (sqrt (* -16.0 (* C F)))))
(if (<= C 8.229399684641769e+106)
(/
(- (sqrt (* t_0 (* 2.0 (* F (fma A 2.0 (* -0.5 (/ (* B B) C))))))))
t_0)
(*
-0.25
(/ (pow (exp (* 0.25 (+ (log C) (log (* -16.0 F))))) 2.0) 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 = fma(A, (C * -4.0), (B * B));
double tmp;
if (C <= -9.383027144283094e-186) {
tmp = -0.25 * ((sqrt((C * -16.0)) * sqrt(F)) / C);
} else if (C <= 2.874342306042804e-58) {
tmp = -(sqrt(t_0) * sqrt((2.0 * (F * ((C + A) - hypot(B, (A - C))))))) / t_0;
} else if (C <= 9.739838238220798e+53) {
tmp = -0.25 * ((1.0 / C) * sqrt((-16.0 * (C * F))));
} else if (C <= 8.229399684641769e+106) {
tmp = -sqrt((t_0 * (2.0 * (F * fma(A, 2.0, (-0.5 * ((B * B) / C))))))) / t_0;
} else {
tmp = -0.25 * (pow(exp((0.25 * (log(C) + log((-16.0 * F))))), 2.0) / C);
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C



Bits error versus F
if C < -9.38302714428309379e-186Initial program 48.6
Simplified43.1
Taylor expanded in C around inf 49.5
Taylor expanded in A around -inf 32.1
Applied egg-rr26.6
if -9.38302714428309379e-186 < C < 2.87434230604280395e-58Initial program 43.6
Simplified38.1
Applied egg-rr34.0
if 2.87434230604280395e-58 < C < 9.7398382382207985e53Initial program 50.2
Simplified48.6
Taylor expanded in C around inf 45.2
Taylor expanded in A around -inf 37.8
Applied egg-rr37.8
if 9.7398382382207985e53 < C < 8.229399684641769e106Initial program 57.6
Simplified56.6
Taylor expanded in C around inf 38.5
Applied egg-rr38.5
if 8.229399684641769e106 < C Initial program 63.3
Simplified62.2
Taylor expanded in C around inf 42.8
Taylor expanded in A around -inf 40.5
Applied egg-rr40.6
Taylor expanded in C around 0 31.8
Final simplification33.1
herbie shell --seed 2022130
(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))))