\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.2092322739463293 \cdot 10^{-86}:\\
\;\;\;\;-\frac{c}{b}\\
\mathbf{elif}\;b \le 2.891777552454845 \cdot 10^{+74}:\\
\;\;\;\;\frac{\left(\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(\left(c \cdot a\right) \cdot -4\right)\right)}\right) \cdot \frac{1}{2}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}double f(double a, double b, double c) {
double r2166290 = b;
double r2166291 = -r2166290;
double r2166292 = r2166290 * r2166290;
double r2166293 = 4.0;
double r2166294 = a;
double r2166295 = c;
double r2166296 = r2166294 * r2166295;
double r2166297 = r2166293 * r2166296;
double r2166298 = r2166292 - r2166297;
double r2166299 = sqrt(r2166298);
double r2166300 = r2166291 - r2166299;
double r2166301 = 2.0;
double r2166302 = r2166301 * r2166294;
double r2166303 = r2166300 / r2166302;
return r2166303;
}
double f(double a, double b, double c) {
double r2166304 = b;
double r2166305 = -3.2092322739463293e-86;
bool r2166306 = r2166304 <= r2166305;
double r2166307 = c;
double r2166308 = r2166307 / r2166304;
double r2166309 = -r2166308;
double r2166310 = 2.891777552454845e+74;
bool r2166311 = r2166304 <= r2166310;
double r2166312 = -r2166304;
double r2166313 = a;
double r2166314 = r2166307 * r2166313;
double r2166315 = -4.0;
double r2166316 = r2166314 * r2166315;
double r2166317 = fma(r2166304, r2166304, r2166316);
double r2166318 = sqrt(r2166317);
double r2166319 = r2166312 - r2166318;
double r2166320 = 0.5;
double r2166321 = r2166319 * r2166320;
double r2166322 = r2166321 / r2166313;
double r2166323 = r2166312 / r2166313;
double r2166324 = r2166311 ? r2166322 : r2166323;
double r2166325 = r2166306 ? r2166309 : r2166324;
return r2166325;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.6 |
|---|---|
| Target | 20.7 |
| Herbie | 10.0 |
if b < -3.2092322739463293e-86Initial program 52.3
rmApplied div-inv52.3
Simplified52.3
rmApplied associate-*r/52.3
Simplified52.3
Taylor expanded around -inf 9.4
Simplified9.4
if -3.2092322739463293e-86 < b < 2.891777552454845e+74Initial program 13.1
rmApplied div-inv13.2
Simplified13.2
rmApplied associate-*r/13.1
Simplified13.1
if 2.891777552454845e+74 < b Initial program 38.9
rmApplied *-un-lft-identity38.9
Applied *-un-lft-identity38.9
Applied distribute-rgt-neg-in38.9
Applied distribute-lft-out--38.9
Applied associate-/l*39.0
Simplified39.0
Taylor expanded around 0 4.4
Simplified4.4
Final simplification10.0
herbie shell --seed 2019130 +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)))