\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.5396067403637575 \cdot 10^{153}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\mathbf{elif}\;b \le -3.8324699600337675 \cdot 10^{-264}:\\
\;\;\;\;\frac{1}{\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}\\
\mathbf{elif}\;b \le 3.74051362294476169 \cdot 10^{55}:\\
\;\;\;\;\frac{\frac{\left({b}^{2} - {b}^{2}\right) + 4 \cdot \left(a \cdot c\right)}{2 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\end{array}double code(double a, double b, double c) {
return ((-b + sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a));
}
double code(double a, double b, double c) {
double VAR;
if ((b <= -1.5396067403637575e+153)) {
VAR = (1.0 * ((c / b) - (b / a)));
} else {
double VAR_1;
if ((b <= -3.8324699600337675e-264)) {
VAR_1 = (1.0 / ((2.0 * a) / (-b + sqrt(((b * b) - (4.0 * (a * c)))))));
} else {
double VAR_2;
if ((b <= 3.7405136229447617e+55)) {
VAR_2 = ((((pow(b, 2.0) - pow(b, 2.0)) + (4.0 * (a * c))) / (2.0 * a)) / (-b - sqrt(((b * b) - (4.0 * (a * c))))));
} else {
VAR_2 = (-1.0 * (c / b));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.8 |
|---|---|
| Target | 20.9 |
| Herbie | 8.8 |
if b < -1.5396067403637575e+153Initial program 63.1
Taylor expanded around -inf 2.3
Simplified2.3
if -1.5396067403637575e+153 < b < -3.8324699600337675e-264Initial program 8.1
rmApplied clear-num8.3
if -3.8324699600337675e-264 < b < 3.7405136229447617e+55Initial program 29.0
rmApplied clear-num29.0
rmApplied flip-+29.0
Applied associate-/r/29.1
Applied associate-/r*29.1
Simplified16.8
if 3.7405136229447617e+55 < b Initial program 57.4
Taylor expanded around inf 3.4
Final simplification8.8
herbie shell --seed 2020105
(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)))