\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 r9527252 = b;
double r9527253 = -r9527252;
double r9527254 = r9527252 * r9527252;
double r9527255 = 4.0;
double r9527256 = a;
double r9527257 = r9527255 * r9527256;
double r9527258 = c;
double r9527259 = r9527257 * r9527258;
double r9527260 = r9527254 - r9527259;
double r9527261 = sqrt(r9527260);
double r9527262 = r9527253 + r9527261;
double r9527263 = 2.0;
double r9527264 = r9527263 * r9527256;
double r9527265 = r9527262 / r9527264;
return r9527265;
}
double f(double a, double b, double c) {
double r9527266 = b;
double r9527267 = -2.1884247920746475e+101;
bool r9527268 = r9527266 <= r9527267;
double r9527269 = c;
double r9527270 = r9527269 / r9527266;
double r9527271 = a;
double r9527272 = r9527266 / r9527271;
double r9527273 = r9527270 - r9527272;
double r9527274 = -1.6086609448752587e-299;
bool r9527275 = r9527266 <= r9527274;
double r9527276 = r9527266 * r9527266;
double r9527277 = r9527269 * r9527271;
double r9527278 = 4.0;
double r9527279 = r9527277 * r9527278;
double r9527280 = r9527276 - r9527279;
double r9527281 = sqrt(r9527280);
double r9527282 = 1.0;
double r9527283 = 2.0;
double r9527284 = r9527271 * r9527283;
double r9527285 = r9527282 / r9527284;
double r9527286 = r9527281 * r9527285;
double r9527287 = r9527266 / r9527284;
double r9527288 = r9527286 - r9527287;
double r9527289 = 9.34348145460108e+88;
bool r9527290 = r9527266 <= r9527289;
double r9527291 = r9527281 + r9527266;
double r9527292 = r9527282 / r9527291;
double r9527293 = -2.0;
double r9527294 = r9527269 * r9527293;
double r9527295 = r9527292 * r9527294;
double r9527296 = -r9527269;
double r9527297 = r9527296 / r9527266;
double r9527298 = r9527290 ? r9527295 : r9527297;
double r9527299 = r9527275 ? r9527288 : r9527298;
double r9527300 = r9527268 ? r9527273 : r9527299;
return r9527300;
}




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
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)))