\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 -3.25165686884117225057308430661709452775 \cdot 10^{152}:\\
\;\;\;\;\left(\frac{c}{b} - \frac{b}{a}\right) \cdot 1\\
\mathbf{elif}\;b \le 4.612990823111230552052602417245542305295 \cdot 10^{-104}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -1\\
\end{array}double f(double a, double b, double c) {
double r4460882 = b;
double r4460883 = -r4460882;
double r4460884 = r4460882 * r4460882;
double r4460885 = 4.0;
double r4460886 = a;
double r4460887 = c;
double r4460888 = r4460886 * r4460887;
double r4460889 = r4460885 * r4460888;
double r4460890 = r4460884 - r4460889;
double r4460891 = sqrt(r4460890);
double r4460892 = r4460883 + r4460891;
double r4460893 = 2.0;
double r4460894 = r4460893 * r4460886;
double r4460895 = r4460892 / r4460894;
return r4460895;
}
double f(double a, double b, double c) {
double r4460896 = b;
double r4460897 = -3.2516568688411723e+152;
bool r4460898 = r4460896 <= r4460897;
double r4460899 = c;
double r4460900 = r4460899 / r4460896;
double r4460901 = a;
double r4460902 = r4460896 / r4460901;
double r4460903 = r4460900 - r4460902;
double r4460904 = 1.0;
double r4460905 = r4460903 * r4460904;
double r4460906 = 4.6129908231112306e-104;
bool r4460907 = r4460896 <= r4460906;
double r4460908 = r4460896 * r4460896;
double r4460909 = 4.0;
double r4460910 = r4460901 * r4460909;
double r4460911 = r4460910 * r4460899;
double r4460912 = r4460908 - r4460911;
double r4460913 = sqrt(r4460912);
double r4460914 = r4460913 - r4460896;
double r4460915 = r4460914 / r4460901;
double r4460916 = 2.0;
double r4460917 = r4460915 / r4460916;
double r4460918 = -1.0;
double r4460919 = r4460900 * r4460918;
double r4460920 = r4460907 ? r4460917 : r4460919;
double r4460921 = r4460898 ? r4460905 : r4460920;
return r4460921;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.9 |
|---|---|
| Target | 21.3 |
| Herbie | 10.0 |
if b < -3.2516568688411723e+152Initial program 63.5
Simplified63.5
rmApplied *-un-lft-identity63.5
Applied div-inv63.5
Applied times-frac63.5
Simplified63.5
rmApplied associate-*r/63.5
Simplified63.5
Taylor expanded around -inf 2.3
Simplified2.3
if -3.2516568688411723e+152 < b < 4.6129908231112306e-104Initial program 12.1
Simplified12.1
rmApplied *-un-lft-identity12.1
Applied div-inv12.3
Applied times-frac12.3
Simplified12.2
rmApplied associate-*r/12.2
Simplified12.1
if 4.6129908231112306e-104 < b Initial program 52.7
Simplified52.7
Taylor expanded around inf 9.8
Final simplification10.0
herbie shell --seed 2019170 +o rules:numerics
(FPCore (a b c)
:name "quadp (p42, positive)"
:herbie-target
(if (< b 0.0) (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))))
(/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))