\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.279587145681289 \cdot 10^{-136}:\\
\;\;\;\;1 \cdot \left(-1 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \le 6.8526453862578789 \cdot 10^{139}:\\
\;\;\;\;1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\right)\\
\end{array}double f(double a, double b, double c) {
double r89721 = b;
double r89722 = -r89721;
double r89723 = r89721 * r89721;
double r89724 = 4.0;
double r89725 = a;
double r89726 = c;
double r89727 = r89725 * r89726;
double r89728 = r89724 * r89727;
double r89729 = r89723 - r89728;
double r89730 = sqrt(r89729);
double r89731 = r89722 - r89730;
double r89732 = 2.0;
double r89733 = r89732 * r89725;
double r89734 = r89731 / r89733;
return r89734;
}
double f(double a, double b, double c) {
double r89735 = b;
double r89736 = -1.279587145681289e-136;
bool r89737 = r89735 <= r89736;
double r89738 = 1.0;
double r89739 = -1.0;
double r89740 = c;
double r89741 = r89740 / r89735;
double r89742 = r89739 * r89741;
double r89743 = r89738 * r89742;
double r89744 = 6.852645386257879e+139;
bool r89745 = r89735 <= r89744;
double r89746 = -r89735;
double r89747 = r89735 * r89735;
double r89748 = 4.0;
double r89749 = a;
double r89750 = r89749 * r89740;
double r89751 = r89748 * r89750;
double r89752 = r89747 - r89751;
double r89753 = sqrt(r89752);
double r89754 = r89746 - r89753;
double r89755 = 2.0;
double r89756 = r89755 * r89749;
double r89757 = r89754 / r89756;
double r89758 = r89738 * r89757;
double r89759 = 1.0;
double r89760 = r89735 / r89749;
double r89761 = r89741 - r89760;
double r89762 = r89759 * r89761;
double r89763 = r89738 * r89762;
double r89764 = r89745 ? r89758 : r89763;
double r89765 = r89737 ? r89743 : r89764;
return r89765;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.5 |
|---|---|
| Target | 21.1 |
| Herbie | 10.5 |
if b < -1.279587145681289e-136Initial program 51.1
rmApplied div-inv51.1
rmApplied *-un-lft-identity51.1
Applied associate-*l*51.1
Simplified51.1
Taylor expanded around -inf 12.2
if -1.279587145681289e-136 < b < 6.852645386257879e+139Initial program 11.1
rmApplied div-inv11.2
rmApplied *-un-lft-identity11.2
Applied associate-*l*11.2
Simplified11.1
if 6.852645386257879e+139 < b Initial program 57.7
rmApplied div-inv57.7
rmApplied *-un-lft-identity57.7
Applied associate-*l*57.7
Simplified57.7
Taylor expanded around inf 2.2
Simplified2.2
Final simplification10.5
herbie shell --seed 2020089 +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)))