\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 -5.87486430558009272 \cdot 10^{54}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le -9.8475017814633646 \cdot 10^{24}:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(b, b, -\left(b \cdot b - 4 \cdot \left(a \cdot c\right)\right)\right)}{a}}{2}}{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\\
\mathbf{elif}\;b \le -3.1369770416067291 \cdot 10^{-74}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 1.05775171304890479 \cdot 10^{130}:\\
\;\;\;\;{\left(\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\right)}^{1}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{b}{a}\\
\end{array}double f(double a, double b, double c) {
double r72582 = b;
double r72583 = -r72582;
double r72584 = r72582 * r72582;
double r72585 = 4.0;
double r72586 = a;
double r72587 = c;
double r72588 = r72586 * r72587;
double r72589 = r72585 * r72588;
double r72590 = r72584 - r72589;
double r72591 = sqrt(r72590);
double r72592 = r72583 - r72591;
double r72593 = 2.0;
double r72594 = r72593 * r72586;
double r72595 = r72592 / r72594;
return r72595;
}
double f(double a, double b, double c) {
double r72596 = b;
double r72597 = -5.874864305580093e+54;
bool r72598 = r72596 <= r72597;
double r72599 = -1.0;
double r72600 = c;
double r72601 = r72600 / r72596;
double r72602 = r72599 * r72601;
double r72603 = -9.847501781463365e+24;
bool r72604 = r72596 <= r72603;
double r72605 = r72596 * r72596;
double r72606 = 4.0;
double r72607 = a;
double r72608 = r72607 * r72600;
double r72609 = r72606 * r72608;
double r72610 = r72605 - r72609;
double r72611 = -r72610;
double r72612 = fma(r72596, r72596, r72611);
double r72613 = r72612 / r72607;
double r72614 = 2.0;
double r72615 = r72613 / r72614;
double r72616 = -r72596;
double r72617 = sqrt(r72610);
double r72618 = r72616 + r72617;
double r72619 = r72615 / r72618;
double r72620 = -3.136977041606729e-74;
bool r72621 = r72596 <= r72620;
double r72622 = 1.0577517130489048e+130;
bool r72623 = r72596 <= r72622;
double r72624 = r72616 - r72617;
double r72625 = r72614 * r72607;
double r72626 = r72624 / r72625;
double r72627 = 1.0;
double r72628 = pow(r72626, r72627);
double r72629 = r72596 / r72607;
double r72630 = r72599 * r72629;
double r72631 = r72623 ? r72628 : r72630;
double r72632 = r72621 ? r72602 : r72631;
double r72633 = r72604 ? r72619 : r72632;
double r72634 = r72598 ? r72602 : r72633;
return r72634;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 34.0 |
|---|---|
| Target | 21.3 |
| Herbie | 11.2 |
if b < -5.874864305580093e+54 or -9.847501781463365e+24 < b < -3.136977041606729e-74Initial program 54.2
Taylor expanded around -inf 8.6
if -5.874864305580093e+54 < b < -9.847501781463365e+24Initial program 43.9
rmApplied div-inv43.9
rmApplied flip--43.9
Applied associate-*l/43.9
Simplified49.9
if -3.136977041606729e-74 < b < 1.0577517130489048e+130Initial program 12.8
rmApplied div-inv12.9
rmApplied pow112.9
Applied pow112.9
Applied pow-prod-down12.9
Simplified12.8
if 1.0577517130489048e+130 < b Initial program 55.7
rmApplied clear-num55.8
Taylor expanded around 0 3.2
Final simplification11.2
herbie shell --seed 2020034 +o rules:numerics
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
:herbie-target
(if (< b 0.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)))