\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 -2.1884247920746475 \cdot 10^{+101}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \le -1.6086609448752587 \cdot 10^{-299}:\\
\;\;\;\;\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot \frac{1}{a \cdot 2} - \frac{b}{a \cdot 2}\\
\mathbf{elif}\;b \le 9.34348145460108 \cdot 10^{+88}:\\
\;\;\;\;\frac{1}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b} \cdot \left(c \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}double f(double a, double b, double c) {
double r17627045 = b;
double r17627046 = -r17627045;
double r17627047 = r17627045 * r17627045;
double r17627048 = 4.0;
double r17627049 = a;
double r17627050 = r17627048 * r17627049;
double r17627051 = c;
double r17627052 = r17627050 * r17627051;
double r17627053 = r17627047 - r17627052;
double r17627054 = sqrt(r17627053);
double r17627055 = r17627046 + r17627054;
double r17627056 = 2.0;
double r17627057 = r17627056 * r17627049;
double r17627058 = r17627055 / r17627057;
return r17627058;
}
double f(double a, double b, double c) {
double r17627059 = b;
double r17627060 = -2.1884247920746475e+101;
bool r17627061 = r17627059 <= r17627060;
double r17627062 = c;
double r17627063 = r17627062 / r17627059;
double r17627064 = a;
double r17627065 = r17627059 / r17627064;
double r17627066 = r17627063 - r17627065;
double r17627067 = -1.6086609448752587e-299;
bool r17627068 = r17627059 <= r17627067;
double r17627069 = r17627059 * r17627059;
double r17627070 = r17627062 * r17627064;
double r17627071 = 4.0;
double r17627072 = r17627070 * r17627071;
double r17627073 = r17627069 - r17627072;
double r17627074 = sqrt(r17627073);
double r17627075 = 1.0;
double r17627076 = 2.0;
double r17627077 = r17627064 * r17627076;
double r17627078 = r17627075 / r17627077;
double r17627079 = r17627074 * r17627078;
double r17627080 = r17627059 / r17627077;
double r17627081 = r17627079 - r17627080;
double r17627082 = 9.34348145460108e+88;
bool r17627083 = r17627059 <= r17627082;
double r17627084 = r17627074 + r17627059;
double r17627085 = r17627075 / r17627084;
double r17627086 = -2.0;
double r17627087 = r17627062 * r17627086;
double r17627088 = r17627085 * r17627087;
double r17627089 = -r17627062;
double r17627090 = r17627089 / r17627059;
double r17627091 = r17627083 ? r17627088 : r17627090;
double r17627092 = r17627068 ? r17627081 : r17627091;
double r17627093 = r17627061 ? r17627066 : r17627092;
return r17627093;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.1 |
|---|---|
| Target | 20.3 |
| Herbie | 6.6 |
if b < -2.1884247920746475e+101Initial program 44.5
Simplified44.5
rmApplied div-sub44.5
Taylor expanded around -inf 3.3
if -2.1884247920746475e+101 < b < -1.6086609448752587e-299Initial program 8.7
Simplified8.7
rmApplied div-sub8.7
rmApplied div-inv8.8
if -1.6086609448752587e-299 < b < 9.34348145460108e+88Initial program 31.3
Simplified31.3
rmApplied *-un-lft-identity31.3
Applied *-un-lft-identity31.3
Applied distribute-lft-out--31.3
Applied associate-/l*31.4
rmApplied flip--31.5
Applied associate-/r/31.5
Applied *-un-lft-identity31.5
Applied times-frac31.5
Simplified16.1
Taylor expanded around -inf 9.2
if 9.34348145460108e+88 < b Initial program 57.8
Simplified57.8
rmApplied div-sub58.8
Taylor expanded around inf 2.8
Simplified2.8
Final simplification6.6
herbie shell --seed 2019107
(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)))