\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -8.544460916074322 \cdot 10^{-48}:\\
\;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\
\mathbf{elif}\;b \le 1.5983000936606613 \cdot 10^{-121}:\\
\;\;\;\;\frac{\frac{\frac{b \cdot b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{\sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)} + \left(-b\right)}}{a}}{2}\\
\mathbf{elif}\;b \le 2.6656023684116586 \cdot 10^{+55}:\\
\;\;\;\;\frac{\frac{-\frac{\mathsf{fma}\left(b \cdot b, b, \mathsf{fma}\left(a, -4 \cdot c, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, -4 \cdot c, b \cdot b\right)}\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a, -4 \cdot c, b \cdot b\right)}, \sqrt{\mathsf{fma}\left(a, -4 \cdot c, b \cdot b\right)} - b, b \cdot b\right)}}{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{b}{a} \cdot -2}{2}\\
\end{array}double f(double a, double b, double c) {
double r2888912 = b;
double r2888913 = -r2888912;
double r2888914 = r2888912 * r2888912;
double r2888915 = 4.0;
double r2888916 = a;
double r2888917 = c;
double r2888918 = r2888916 * r2888917;
double r2888919 = r2888915 * r2888918;
double r2888920 = r2888914 - r2888919;
double r2888921 = sqrt(r2888920);
double r2888922 = r2888913 - r2888921;
double r2888923 = 2.0;
double r2888924 = r2888923 * r2888916;
double r2888925 = r2888922 / r2888924;
return r2888925;
}
double f(double a, double b, double c) {
double r2888926 = b;
double r2888927 = -8.544460916074322e-48;
bool r2888928 = r2888926 <= r2888927;
double r2888929 = -2.0;
double r2888930 = c;
double r2888931 = r2888930 / r2888926;
double r2888932 = r2888929 * r2888931;
double r2888933 = 2.0;
double r2888934 = r2888932 / r2888933;
double r2888935 = 1.5983000936606613e-121;
bool r2888936 = r2888926 <= r2888935;
double r2888937 = r2888926 * r2888926;
double r2888938 = a;
double r2888939 = -4.0;
double r2888940 = r2888938 * r2888939;
double r2888941 = fma(r2888930, r2888940, r2888937);
double r2888942 = sqrt(r2888941);
double r2888943 = r2888942 * r2888942;
double r2888944 = r2888937 - r2888943;
double r2888945 = -r2888926;
double r2888946 = r2888942 + r2888945;
double r2888947 = r2888944 / r2888946;
double r2888948 = r2888947 / r2888938;
double r2888949 = r2888948 / r2888933;
double r2888950 = 2.6656023684116586e+55;
bool r2888951 = r2888926 <= r2888950;
double r2888952 = r2888939 * r2888930;
double r2888953 = fma(r2888938, r2888952, r2888937);
double r2888954 = sqrt(r2888953);
double r2888955 = r2888953 * r2888954;
double r2888956 = fma(r2888937, r2888926, r2888955);
double r2888957 = r2888954 - r2888926;
double r2888958 = fma(r2888954, r2888957, r2888937);
double r2888959 = r2888956 / r2888958;
double r2888960 = -r2888959;
double r2888961 = r2888960 / r2888938;
double r2888962 = r2888961 / r2888933;
double r2888963 = r2888926 / r2888938;
double r2888964 = r2888963 * r2888929;
double r2888965 = r2888964 / r2888933;
double r2888966 = r2888951 ? r2888962 : r2888965;
double r2888967 = r2888936 ? r2888949 : r2888966;
double r2888968 = r2888928 ? r2888934 : r2888967;
return r2888968;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 34.0 |
|---|---|
| Target | 21.3 |
| Herbie | 12.1 |
if b < -8.544460916074322e-48Initial program 54.0
Simplified54.1
Taylor expanded around -inf 7.8
if -8.544460916074322e-48 < b < 1.5983000936606613e-121Initial program 19.2
Simplified19.2
rmApplied *-un-lft-identity19.2
Applied *-un-lft-identity19.2
Applied distribute-lft-out--19.2
Applied associate-/l*19.3
rmApplied *-un-lft-identity19.3
Applied *-un-lft-identity19.3
Applied distribute-lft-out--19.3
Applied *-un-lft-identity19.3
Applied times-frac19.3
Applied *-un-lft-identity19.3
Applied times-frac19.3
Simplified19.3
Simplified19.2
rmApplied flip--21.1
if 1.5983000936606613e-121 < b < 2.6656023684116586e+55Initial program 5.8
Simplified5.9
rmApplied flip3--12.9
Simplified12.8
Simplified12.8
if 2.6656023684116586e+55 < b Initial program 37.1
Simplified37.1
rmApplied *-un-lft-identity37.1
Applied *-un-lft-identity37.1
Applied distribute-lft-out--37.1
Applied associate-/l*37.2
Taylor expanded around 0 6.5
Final simplification12.1
herbie shell --seed 2019141 +o rules:numerics
(FPCore (a b c)
:name "The quadratic formula (r2)"
:herbie-target
(if (< b 0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))