\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 7.579106596092839 \cdot 10^{-190}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -4, b \cdot b\right)}}{a} - \frac{b}{a}}{2}\\
\mathbf{elif}\;b \le 3.188391854507535 \cdot 10^{+149}:\\
\;\;\;\;\frac{\frac{1}{b + \sqrt{\mathsf{fma}\left(a \cdot c, -4, b \cdot b\right)}} \cdot \left(-4 \cdot c\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-4 \cdot c}{b + b}}{2}\\
\end{array}double f(double a, double b, double c) {
double r2386950 = b;
double r2386951 = -r2386950;
double r2386952 = r2386950 * r2386950;
double r2386953 = 4.0;
double r2386954 = a;
double r2386955 = c;
double r2386956 = r2386954 * r2386955;
double r2386957 = r2386953 * r2386956;
double r2386958 = r2386952 - r2386957;
double r2386959 = sqrt(r2386958);
double r2386960 = r2386951 + r2386959;
double r2386961 = 2.0;
double r2386962 = r2386961 * r2386954;
double r2386963 = r2386960 / r2386962;
return r2386963;
}
double f(double a, double b, double c) {
double r2386964 = b;
double r2386965 = 7.579106596092839e-190;
bool r2386966 = r2386964 <= r2386965;
double r2386967 = a;
double r2386968 = c;
double r2386969 = r2386967 * r2386968;
double r2386970 = -4.0;
double r2386971 = r2386964 * r2386964;
double r2386972 = fma(r2386969, r2386970, r2386971);
double r2386973 = sqrt(r2386972);
double r2386974 = r2386973 / r2386967;
double r2386975 = r2386964 / r2386967;
double r2386976 = r2386974 - r2386975;
double r2386977 = 2.0;
double r2386978 = r2386976 / r2386977;
double r2386979 = 3.188391854507535e+149;
bool r2386980 = r2386964 <= r2386979;
double r2386981 = 1.0;
double r2386982 = r2386964 + r2386973;
double r2386983 = r2386981 / r2386982;
double r2386984 = r2386970 * r2386968;
double r2386985 = r2386983 * r2386984;
double r2386986 = r2386985 / r2386977;
double r2386987 = r2386964 + r2386964;
double r2386988 = r2386984 / r2386987;
double r2386989 = r2386988 / r2386977;
double r2386990 = r2386980 ? r2386986 : r2386989;
double r2386991 = r2386966 ? r2386978 : r2386990;
return r2386991;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.5 |
|---|---|
| Target | 21.2 |
| Herbie | 13.2 |
if b < 7.579106596092839e-190Initial program 20.7
Simplified20.6
rmApplied div-sub20.7
if 7.579106596092839e-190 < b < 3.188391854507535e+149Initial program 38.6
Simplified38.6
rmApplied clear-num38.7
rmApplied flip--38.8
Applied associate-/r/38.8
Applied associate-/r*38.8
Simplified13.6
Taylor expanded around inf 6.5
rmApplied div-inv6.7
if 3.188391854507535e+149 < b Initial program 62.3
Simplified62.3
rmApplied clear-num62.3
rmApplied flip--62.4
Applied associate-/r/62.4
Applied associate-/r*62.4
Simplified39.6
Taylor expanded around inf 39.4
Taylor expanded around 0 1.8
Final simplification13.2
herbie shell --seed 2019139 +o rules:numerics
(FPCore (a b c)
:name "quadp (p42, positive)"
:herbie-target
(if (< b 0) (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))))
(/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))