\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.303853124735619 \cdot 10^{+50}:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \left(\frac{c}{b} \cdot a - b\right)}\\
\mathbf{elif}\;b \le -1.1213491597431702 \cdot 10^{-288}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\\
\mathbf{elif}\;b \le 3.843928652480689 \cdot 10^{+118}:\\
\;\;\;\;\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}double f(double a, double b, double c) {
double r4387119 = b;
double r4387120 = -r4387119;
double r4387121 = r4387119 * r4387119;
double r4387122 = 4.0;
double r4387123 = a;
double r4387124 = c;
double r4387125 = r4387123 * r4387124;
double r4387126 = r4387122 * r4387125;
double r4387127 = r4387121 - r4387126;
double r4387128 = sqrt(r4387127);
double r4387129 = r4387120 - r4387128;
double r4387130 = 2.0;
double r4387131 = r4387130 * r4387123;
double r4387132 = r4387129 / r4387131;
return r4387132;
}
double f(double a, double b, double c) {
double r4387133 = b;
double r4387134 = -3.303853124735619e+50;
bool r4387135 = r4387133 <= r4387134;
double r4387136 = 2.0;
double r4387137 = c;
double r4387138 = r4387136 * r4387137;
double r4387139 = r4387137 / r4387133;
double r4387140 = a;
double r4387141 = r4387139 * r4387140;
double r4387142 = r4387141 - r4387133;
double r4387143 = r4387136 * r4387142;
double r4387144 = r4387138 / r4387143;
double r4387145 = -1.1213491597431702e-288;
bool r4387146 = r4387133 <= r4387145;
double r4387147 = -r4387133;
double r4387148 = r4387133 * r4387133;
double r4387149 = 4.0;
double r4387150 = r4387140 * r4387137;
double r4387151 = r4387149 * r4387150;
double r4387152 = r4387148 - r4387151;
double r4387153 = sqrt(r4387152);
double r4387154 = r4387147 + r4387153;
double r4387155 = r4387138 / r4387154;
double r4387156 = 3.843928652480689e+118;
bool r4387157 = r4387133 <= r4387156;
double r4387158 = 1.0;
double r4387159 = r4387136 * r4387140;
double r4387160 = r4387158 / r4387159;
double r4387161 = r4387147 - r4387153;
double r4387162 = r4387160 * r4387161;
double r4387163 = r4387147 / r4387140;
double r4387164 = r4387157 ? r4387162 : r4387163;
double r4387165 = r4387146 ? r4387155 : r4387164;
double r4387166 = r4387135 ? r4387144 : r4387165;
return r4387166;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.3 |
|---|---|
| Target | 20.2 |
| Herbie | 6.5 |
if b < -3.303853124735619e+50Initial program 55.7
rmApplied div-inv55.7
rmApplied flip--55.8
Applied associate-*l/55.8
Simplified26.1
Taylor expanded around inf 24.3
Taylor expanded around -inf 6.8
Simplified3.7
if -3.303853124735619e+50 < b < -1.1213491597431702e-288Initial program 29.8
rmApplied div-inv29.9
rmApplied flip--30.0
Applied associate-*l/30.0
Simplified16.5
Taylor expanded around inf 8.5
if -1.1213491597431702e-288 < b < 3.843928652480689e+118Initial program 8.5
rmApplied div-inv8.6
if 3.843928652480689e+118 < b Initial program 50.9
rmApplied div-inv50.9
rmApplied flip--61.9
Applied associate-*l/61.9
Simplified62.1
Taylor expanded around inf 62.0
Taylor expanded around 0 3.7
Simplified3.7
Final simplification6.5
herbie shell --seed 2019119
(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)))