\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.478406535480561669630649836752919254545 \cdot 10^{60}:\\
\;\;\;\;\frac{1}{2} \cdot \mathsf{fma}\left(2, \frac{c}{b}, -2 \cdot \frac{b}{a}\right)\\
\mathbf{elif}\;b \le 2.175674080408202904737521150531781836244 \cdot 10^{-169} \lor \neg \left(b \le 4.731827132847258030366645007940380497628 \cdot 10^{-110}\right) \land b \le 1.846537578115044209159378851836663670838 \cdot 10^{-4}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{\sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\end{array}double f(double a, double b, double c) {
double r79514 = b;
double r79515 = -r79514;
double r79516 = r79514 * r79514;
double r79517 = 4.0;
double r79518 = a;
double r79519 = c;
double r79520 = r79518 * r79519;
double r79521 = r79517 * r79520;
double r79522 = r79516 - r79521;
double r79523 = sqrt(r79522);
double r79524 = r79515 + r79523;
double r79525 = 2.0;
double r79526 = r79525 * r79518;
double r79527 = r79524 / r79526;
return r79527;
}
double f(double a, double b, double c) {
double r79528 = b;
double r79529 = -1.4784065354805617e+60;
bool r79530 = r79528 <= r79529;
double r79531 = 1.0;
double r79532 = 2.0;
double r79533 = r79531 / r79532;
double r79534 = c;
double r79535 = r79534 / r79528;
double r79536 = -2.0;
double r79537 = a;
double r79538 = r79528 / r79537;
double r79539 = r79536 * r79538;
double r79540 = fma(r79532, r79535, r79539);
double r79541 = r79533 * r79540;
double r79542 = 2.175674080408203e-169;
bool r79543 = r79528 <= r79542;
double r79544 = 4.731827132847258e-110;
bool r79545 = r79528 <= r79544;
double r79546 = !r79545;
double r79547 = 0.00018465375781150442;
bool r79548 = r79528 <= r79547;
bool r79549 = r79546 && r79548;
bool r79550 = r79543 || r79549;
double r79551 = 2.0;
double r79552 = pow(r79528, r79551);
double r79553 = 4.0;
double r79554 = r79537 * r79534;
double r79555 = r79553 * r79554;
double r79556 = r79552 - r79555;
double r79557 = sqrt(r79556);
double r79558 = r79557 - r79528;
double r79559 = r79558 / r79537;
double r79560 = r79533 * r79559;
double r79561 = -1.0;
double r79562 = r79561 * r79535;
double r79563 = r79550 ? r79560 : r79562;
double r79564 = r79530 ? r79541 : r79563;
return r79564;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.5 |
|---|---|
| Target | 20.5 |
| Herbie | 11.6 |
if b < -1.4784065354805617e+60Initial program 38.9
Simplified38.9
rmApplied clear-num39.0
rmApplied *-un-lft-identity39.0
Applied times-frac39.0
Applied add-cube-cbrt39.0
Applied times-frac39.1
Simplified39.1
Simplified39.0
Taylor expanded around -inf 5.5
Simplified5.5
if -1.4784065354805617e+60 < b < 2.175674080408203e-169 or 4.731827132847258e-110 < b < 0.00018465375781150442Initial program 15.2
Simplified15.2
rmApplied clear-num15.3
rmApplied *-un-lft-identity15.3
Applied times-frac15.3
Applied add-cube-cbrt15.3
Applied times-frac15.3
Simplified15.3
Simplified15.2
if 2.175674080408203e-169 < b < 4.731827132847258e-110 or 0.00018465375781150442 < b Initial program 51.7
Simplified51.7
Taylor expanded around inf 10.5
Final simplification11.6
herbie shell --seed 2019350 +o rules:numerics
(FPCore (a b c)
:name "quadp (p42, positive)"
:precision binary64
:herbie-target
(if (< b 0.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)))