\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 -8.1855168042470635 \cdot 10^{-53}:\\
\;\;\;\;-\frac{c}{b}\\
\mathbf{elif}\;b \le 3.634898599408338 \cdot 10^{+146}:\\
\;\;\;\;\frac{\frac{-1}{2} \cdot \left(\sqrt{\mathsf{fma}\left(-4 \cdot c, a, b \cdot b\right)} + b\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2 \cdot \left(\frac{c}{\frac{b}{a}} - b\right)}{2}}{a}\\
\end{array}double f(double a, double b, double c) {
double r2616128 = b;
double r2616129 = -r2616128;
double r2616130 = r2616128 * r2616128;
double r2616131 = 4.0;
double r2616132 = a;
double r2616133 = c;
double r2616134 = r2616132 * r2616133;
double r2616135 = r2616131 * r2616134;
double r2616136 = r2616130 - r2616135;
double r2616137 = sqrt(r2616136);
double r2616138 = r2616129 - r2616137;
double r2616139 = 2.0;
double r2616140 = r2616139 * r2616132;
double r2616141 = r2616138 / r2616140;
return r2616141;
}
double f(double a, double b, double c) {
double r2616142 = b;
double r2616143 = -8.1855168042470635e-53;
bool r2616144 = r2616142 <= r2616143;
double r2616145 = c;
double r2616146 = r2616145 / r2616142;
double r2616147 = -r2616146;
double r2616148 = 3.634898599408338e+146;
bool r2616149 = r2616142 <= r2616148;
double r2616150 = -0.5;
double r2616151 = -4.0;
double r2616152 = r2616151 * r2616145;
double r2616153 = a;
double r2616154 = r2616142 * r2616142;
double r2616155 = fma(r2616152, r2616153, r2616154);
double r2616156 = sqrt(r2616155);
double r2616157 = r2616156 + r2616142;
double r2616158 = r2616150 * r2616157;
double r2616159 = r2616158 / r2616153;
double r2616160 = 2.0;
double r2616161 = r2616142 / r2616153;
double r2616162 = r2616145 / r2616161;
double r2616163 = r2616162 - r2616142;
double r2616164 = r2616160 * r2616163;
double r2616165 = r2616164 / r2616160;
double r2616166 = r2616165 / r2616153;
double r2616167 = r2616149 ? r2616159 : r2616166;
double r2616168 = r2616144 ? r2616147 : r2616167;
return r2616168;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.6 |
|---|---|
| Target | 20.6 |
| Herbie | 9.9 |
if b < -8.1855168042470635e-53Initial program 54.3
Simplified54.3
rmApplied *-un-lft-identity54.3
Applied div-inv54.3
Applied times-frac54.3
Simplified54.3
Simplified54.3
Taylor expanded around -inf 7.5
Simplified7.5
if -8.1855168042470635e-53 < b < 3.634898599408338e+146Initial program 13.3
Simplified13.3
rmApplied *-un-lft-identity13.3
Applied div-inv13.3
Applied times-frac13.4
Simplified13.4
Simplified13.4
rmApplied associate-*r/13.3
Simplified13.3
Taylor expanded around -inf 13.3
Simplified13.3
if 3.634898599408338e+146 < b Initial program 58.5
Simplified58.5
Taylor expanded around inf 10.9
Simplified2.1
Final simplification9.9
herbie shell --seed 2019135 +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)))