\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.6581383089037873 \cdot 10^{81}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\mathbf{elif}\;b \le 2.45811587950602871 \cdot 10^{-136}:\\
\;\;\;\;\frac{1}{\frac{2 \cdot a}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\end{array}double f(double a, double b, double c) {
double r61395 = b;
double r61396 = -r61395;
double r61397 = r61395 * r61395;
double r61398 = 4.0;
double r61399 = a;
double r61400 = c;
double r61401 = r61399 * r61400;
double r61402 = r61398 * r61401;
double r61403 = r61397 - r61402;
double r61404 = sqrt(r61403);
double r61405 = r61396 + r61404;
double r61406 = 2.0;
double r61407 = r61406 * r61399;
double r61408 = r61405 / r61407;
return r61408;
}
double f(double a, double b, double c) {
double r61409 = b;
double r61410 = -1.6581383089037873e+81;
bool r61411 = r61409 <= r61410;
double r61412 = 1.0;
double r61413 = c;
double r61414 = r61413 / r61409;
double r61415 = a;
double r61416 = r61409 / r61415;
double r61417 = r61414 - r61416;
double r61418 = r61412 * r61417;
double r61419 = 2.4581158795060287e-136;
bool r61420 = r61409 <= r61419;
double r61421 = 1.0;
double r61422 = 2.0;
double r61423 = r61422 * r61415;
double r61424 = r61409 * r61409;
double r61425 = 4.0;
double r61426 = r61415 * r61413;
double r61427 = r61425 * r61426;
double r61428 = r61424 - r61427;
double r61429 = sqrt(r61428);
double r61430 = r61429 - r61409;
double r61431 = r61423 / r61430;
double r61432 = r61421 / r61431;
double r61433 = -1.0;
double r61434 = r61433 * r61414;
double r61435 = r61420 ? r61432 : r61434;
double r61436 = r61411 ? r61418 : r61435;
return r61436;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.6 |
|---|---|
| Target | 21.3 |
| Herbie | 10.5 |
if b < -1.6581383089037873e+81Initial program 43.9
Simplified43.9
rmApplied div-inv44.0
rmApplied *-un-lft-identity44.0
Applied associate-*l*44.0
Simplified43.9
Taylor expanded around -inf 3.6
Simplified3.6
if -1.6581383089037873e+81 < b < 2.4581158795060287e-136Initial program 11.7
Simplified11.7
rmApplied div-inv11.8
rmApplied *-un-lft-identity11.8
Applied associate-*l*11.8
Simplified11.7
rmApplied clear-num11.8
if 2.4581158795060287e-136 < b Initial program 50.8
Simplified50.8
rmApplied div-inv50.8
rmApplied *-un-lft-identity50.8
Applied associate-*l*50.8
Simplified50.8
Taylor expanded around inf 12.0
Final simplification10.5
herbie shell --seed 2019199 +o rules:numerics
(FPCore (a b c)
:name "quadp (p42, positive)"
:herbie-target
(if (< b 0.0) (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))))
(/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))