\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -9.088000531423294 \cdot 10^{+152}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \le 9.354082991670835 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{a}}{2} - \frac{\frac{b}{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}double f(double a, double b, double c) {
double r2984582 = b;
double r2984583 = -r2984582;
double r2984584 = r2984582 * r2984582;
double r2984585 = 4.0;
double r2984586 = a;
double r2984587 = r2984585 * r2984586;
double r2984588 = c;
double r2984589 = r2984587 * r2984588;
double r2984590 = r2984584 - r2984589;
double r2984591 = sqrt(r2984590);
double r2984592 = r2984583 + r2984591;
double r2984593 = 2.0;
double r2984594 = r2984593 * r2984586;
double r2984595 = r2984592 / r2984594;
return r2984595;
}
double f(double a, double b, double c) {
double r2984596 = b;
double r2984597 = -9.088000531423294e+152;
bool r2984598 = r2984596 <= r2984597;
double r2984599 = c;
double r2984600 = r2984599 / r2984596;
double r2984601 = a;
double r2984602 = r2984596 / r2984601;
double r2984603 = r2984600 - r2984602;
double r2984604 = 9.354082991670835e-125;
bool r2984605 = r2984596 <= r2984604;
double r2984606 = r2984596 * r2984596;
double r2984607 = r2984599 * r2984601;
double r2984608 = 4.0;
double r2984609 = r2984607 * r2984608;
double r2984610 = r2984606 - r2984609;
double r2984611 = sqrt(r2984610);
double r2984612 = r2984611 / r2984601;
double r2984613 = 2.0;
double r2984614 = r2984612 / r2984613;
double r2984615 = r2984602 / r2984613;
double r2984616 = r2984614 - r2984615;
double r2984617 = -r2984600;
double r2984618 = r2984605 ? r2984616 : r2984617;
double r2984619 = r2984598 ? r2984603 : r2984618;
return r2984619;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 32.9 |
|---|---|
| Target | 20.3 |
| Herbie | 10.3 |
if b < -9.088000531423294e+152Initial program 60.4
Simplified60.4
rmApplied *-un-lft-identity60.4
Applied div-inv60.4
Applied times-frac60.4
Simplified60.4
Taylor expanded around -inf 1.5
if -9.088000531423294e+152 < b < 9.354082991670835e-125Initial program 10.9
Simplified10.9
rmApplied div-sub10.9
Applied div-sub10.9
if 9.354082991670835e-125 < b Initial program 49.8
Simplified49.8
rmApplied *-un-lft-identity49.8
Applied div-inv49.8
Applied times-frac49.8
Simplified49.8
Taylor expanded around inf 11.9
Simplified11.9
Final simplification10.3
herbie shell --seed 2019153
(FPCore (a b c)
:name "The quadratic formula (r1)"
: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)))