double f(double a, double b, double c) {
double r6076285 = b;
double r6076286 = -r6076285;
double r6076287 = r6076285 * r6076285;
double r6076288 = 4.0;
double r6076289 = a;
double r6076290 = c;
double r6076291 = r6076289 * r6076290;
double r6076292 = r6076288 * r6076291;
double r6076293 = r6076287 - r6076292;
double r6076294 = sqrt(r6076293);
double r6076295 = r6076286 - r6076294;
double r6076296 = 2.0;
double r6076297 = r6076296 * r6076289;
double r6076298 = r6076295 / r6076297;
return r6076298;
}
double f(double a, double b, double c) {
double r6076299 = b;
double r6076300 = -1.7966305506212728e+65;
bool r6076301 = r6076299 <= r6076300;
double r6076302 = c;
double r6076303 = r6076302 / r6076299;
double r6076304 = -r6076303;
double r6076305 = -2.436990347475487e-257;
bool r6076306 = r6076299 <= r6076305;
double r6076307 = -2.0;
double r6076308 = a;
double r6076309 = r6076308 * r6076302;
double r6076310 = -4.0;
double r6076311 = r6076309 * r6076310;
double r6076312 = fma(r6076299, r6076299, r6076311);
double r6076313 = sqrt(r6076312);
double r6076314 = r6076299 - r6076313;
double r6076315 = r6076307 / r6076314;
double r6076316 = r6076302 * r6076315;
double r6076317 = 2.598286182153128e+84;
bool r6076318 = r6076299 <= r6076317;
double r6076319 = r6076302 * r6076310;
double r6076320 = r6076299 * r6076299;
double r6076321 = fma(r6076308, r6076319, r6076320);
double r6076322 = sqrt(r6076321);
double r6076323 = r6076322 + r6076299;
double r6076324 = -0.5;
double r6076325 = r6076323 * r6076324;
double r6076326 = r6076325 / r6076308;
double r6076327 = -r6076299;
double r6076328 = r6076327 / r6076308;
double r6076329 = r6076318 ? r6076326 : r6076328;
double r6076330 = r6076306 ? r6076316 : r6076329;
double r6076331 = r6076301 ? r6076304 : r6076330;
return r6076331;
}
\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 -1.7966305506212728 \cdot 10^{+65}:\\
\;\;\;\;-\frac{c}{b}\\
\mathbf{elif}\;b \le -2.436990347475487 \cdot 10^{-257}:\\
\;\;\;\;c \cdot \frac{-2}{b - \sqrt{(b \cdot b + \left(\left(a \cdot c\right) \cdot -4\right))_*}}\\
\mathbf{elif}\;b \le 2.598286182153128 \cdot 10^{+84}:\\
\;\;\;\;\frac{\left(\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*} + b\right) \cdot \frac{-1}{2}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}



Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.2 |
|---|---|
| Target | 20.1 |
| Herbie | 7.0 |
if b < -1.7966305506212728e+65Initial program 57.3
Simplified57.3
Taylor expanded around -inf 3.8
Simplified3.8
if -1.7966305506212728e+65 < b < -2.436990347475487e-257Initial program 31.7
Simplified31.6
rmApplied *-un-lft-identity31.6
Applied div-inv31.6
Applied times-frac31.7
Simplified31.7
Simplified31.7
rmApplied flip-+31.8
Applied distribute-neg-frac31.8
Applied frac-times36.6
Simplified21.3
rmApplied sub0-neg21.3
Applied distribute-lft-neg-out21.3
Applied distribute-frac-neg21.3
Simplified8.3
if -2.436990347475487e-257 < b < 2.598286182153128e+84Initial program 10.0
Simplified10.0
rmApplied *-un-lft-identity10.0
Applied div-inv10.0
Applied times-frac10.1
Simplified10.1
Simplified10.1
rmApplied associate-*r/10.0
if 2.598286182153128e+84 < b Initial program 40.7
Simplified40.7
rmApplied *-un-lft-identity40.7
Applied div-inv40.7
Applied times-frac40.8
Simplified40.7
Simplified40.7
rmApplied flip-+60.9
Applied distribute-neg-frac60.9
Applied frac-times61.2
Simplified61.4
rmApplied sub0-neg61.4
Applied distribute-lft-neg-out61.4
Applied distribute-frac-neg61.4
Simplified61.1
Taylor expanded around 0 4.5
Final simplification7.0
herbie shell --seed 2019101 +o rules:numerics
(FPCore (a b c)
:name "quadm (p42, negative)"
:herbie-target
(if (< b 0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))