\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -3.263941314600607 \cdot 10^{+152}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \le -4.687918346756617 \cdot 10^{-254}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{a} \cdot \frac{1}{2}\\
\mathbf{elif}\;b \le 3.463606471108268 \cdot 10^{+121}:\\
\;\;\;\;\frac{c \cdot -2}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}double f(double a, double b, double c) {
double r38382886 = b;
double r38382887 = -r38382886;
double r38382888 = r38382886 * r38382886;
double r38382889 = 4.0;
double r38382890 = a;
double r38382891 = r38382889 * r38382890;
double r38382892 = c;
double r38382893 = r38382891 * r38382892;
double r38382894 = r38382888 - r38382893;
double r38382895 = sqrt(r38382894);
double r38382896 = r38382887 + r38382895;
double r38382897 = 2.0;
double r38382898 = r38382897 * r38382890;
double r38382899 = r38382896 / r38382898;
return r38382899;
}
double f(double a, double b, double c) {
double r38382900 = b;
double r38382901 = -3.263941314600607e+152;
bool r38382902 = r38382900 <= r38382901;
double r38382903 = c;
double r38382904 = r38382903 / r38382900;
double r38382905 = a;
double r38382906 = r38382900 / r38382905;
double r38382907 = r38382904 - r38382906;
double r38382908 = -4.687918346756617e-254;
bool r38382909 = r38382900 <= r38382908;
double r38382910 = r38382900 * r38382900;
double r38382911 = r38382903 * r38382905;
double r38382912 = 4.0;
double r38382913 = r38382911 * r38382912;
double r38382914 = r38382910 - r38382913;
double r38382915 = sqrt(r38382914);
double r38382916 = r38382915 - r38382900;
double r38382917 = r38382916 / r38382905;
double r38382918 = 0.5;
double r38382919 = r38382917 * r38382918;
double r38382920 = 3.463606471108268e+121;
bool r38382921 = r38382900 <= r38382920;
double r38382922 = -2.0;
double r38382923 = r38382903 * r38382922;
double r38382924 = r38382915 + r38382900;
double r38382925 = r38382923 / r38382924;
double r38382926 = -r38382904;
double r38382927 = r38382921 ? r38382925 : r38382926;
double r38382928 = r38382909 ? r38382919 : r38382927;
double r38382929 = r38382902 ? r38382907 : r38382928;
return r38382929;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.3 |
|---|---|
| Target | 20.3 |
| Herbie | 6.4 |
if b < -3.263941314600607e+152Initial program 60.1
Simplified60.1
Taylor expanded around -inf 2.3
if -3.263941314600607e+152 < b < -4.687918346756617e-254Initial program 7.8
Simplified7.8
rmApplied clear-num8.0
rmApplied *-un-lft-identity8.0
Applied *-un-lft-identity8.0
Applied distribute-lft-out--8.0
Applied times-frac8.0
Applied add-sqr-sqrt8.0
Applied times-frac8.0
Simplified8.0
Simplified7.8
if -4.687918346756617e-254 < b < 3.463606471108268e+121Initial program 31.6
Simplified31.6
rmApplied clear-num31.7
rmApplied flip--31.8
Applied associate-/r/31.9
Applied associate-/r*31.9
Simplified14.4
Taylor expanded around inf 8.7
if 3.463606471108268e+121 < b Initial program 59.8
Simplified59.8
Taylor expanded around inf 2.3
Simplified2.3
Final simplification6.4
herbie shell --seed 2019128
(FPCore (a b c)
:name "The quadratic formula (r1)"
: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)))