\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 -9.348931433494438 \cdot 10^{+39}:\\
\;\;\;\;\frac{\left(\frac{c}{b} - \frac{b}{a}\right) \cdot 2}{2}\\
\mathbf{elif}\;b \le 8.90802686721313 \cdot 10^{-265}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(c \cdot a\right)\right)} - b}{a}}{2}\\
\mathbf{elif}\;b \le 6.105883600684466 \cdot 10^{+62}:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(-4, c \cdot a, 0\right)}{a}}{b + \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\
\end{array}double f(double a, double b, double c) {
double r2743302 = b;
double r2743303 = -r2743302;
double r2743304 = r2743302 * r2743302;
double r2743305 = 4.0;
double r2743306 = a;
double r2743307 = c;
double r2743308 = r2743306 * r2743307;
double r2743309 = r2743305 * r2743308;
double r2743310 = r2743304 - r2743309;
double r2743311 = sqrt(r2743310);
double r2743312 = r2743303 + r2743311;
double r2743313 = 2.0;
double r2743314 = r2743313 * r2743306;
double r2743315 = r2743312 / r2743314;
return r2743315;
}
double f(double a, double b, double c) {
double r2743316 = b;
double r2743317 = -9.348931433494438e+39;
bool r2743318 = r2743316 <= r2743317;
double r2743319 = c;
double r2743320 = r2743319 / r2743316;
double r2743321 = a;
double r2743322 = r2743316 / r2743321;
double r2743323 = r2743320 - r2743322;
double r2743324 = 2.0;
double r2743325 = r2743323 * r2743324;
double r2743326 = r2743325 / r2743324;
double r2743327 = 8.90802686721313e-265;
bool r2743328 = r2743316 <= r2743327;
double r2743329 = -4.0;
double r2743330 = r2743319 * r2743321;
double r2743331 = r2743329 * r2743330;
double r2743332 = fma(r2743316, r2743316, r2743331);
double r2743333 = sqrt(r2743332);
double r2743334 = r2743333 - r2743316;
double r2743335 = r2743334 / r2743321;
double r2743336 = r2743335 / r2743324;
double r2743337 = 6.105883600684466e+62;
bool r2743338 = r2743316 <= r2743337;
double r2743339 = 0.0;
double r2743340 = fma(r2743329, r2743330, r2743339);
double r2743341 = r2743340 / r2743321;
double r2743342 = r2743316 * r2743316;
double r2743343 = fma(r2743330, r2743329, r2743342);
double r2743344 = sqrt(r2743343);
double r2743345 = r2743316 + r2743344;
double r2743346 = r2743341 / r2743345;
double r2743347 = r2743346 / r2743324;
double r2743348 = -2.0;
double r2743349 = r2743348 * r2743320;
double r2743350 = r2743349 / r2743324;
double r2743351 = r2743338 ? r2743347 : r2743350;
double r2743352 = r2743328 ? r2743336 : r2743351;
double r2743353 = r2743318 ? r2743326 : r2743352;
return r2743353;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.0 |
|---|---|
| Target | 20.1 |
| Herbie | 9.2 |
if b < -9.348931433494438e+39Initial program 34.0
Simplified34.0
rmApplied div-inv34.1
rmApplied associate-*r/34.0
Simplified34.0
Taylor expanded around -inf 6.2
Simplified6.2
if -9.348931433494438e+39 < b < 8.90802686721313e-265Initial program 10.1
Simplified10.0
rmApplied div-inv10.2
rmApplied associate-*r/10.0
Simplified10.0
if 8.90802686721313e-265 < b < 6.105883600684466e+62Initial program 31.9
Simplified31.9
rmApplied div-inv31.9
rmApplied flip--32.0
Applied associate-*l/32.1
Simplified16.7
if 6.105883600684466e+62 < b Initial program 56.7
Simplified56.7
rmApplied div-inv56.7
rmApplied associate-*r/56.7
Simplified56.7
Taylor expanded around inf 3.2
Final simplification9.2
herbie shell --seed 2019158 +o rules:numerics
(FPCore (a b c)
:name "quadp (p42, positive)"
:herbie-target
(if (< b 0) (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))))
(/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))