\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq -1.277061339333756 \cdot 10^{+154}:\\
\;\;\;\;\frac{c}{b} \cdot -1\\
\mathbf{elif}\;b \leq 1.4168306912023101 \cdot 10^{-226}:\\
\;\;\;\;\frac{4}{2} \cdot \frac{c}{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}\\
\mathbf{elif}\;b \leq 2.2272767242843476 \cdot 10^{+50}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\end{array}(FPCore (a b c) :precision binary64 (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
(FPCore (a b c)
:precision binary64
(if (<= b -1.277061339333756e+154)
(* (/ c b) -1.0)
(if (<= b 1.4168306912023101e-226)
(* (/ 4.0 2.0) (/ c (- (sqrt (- (* b b) (* 4.0 (* c a)))) b)))
(if (<= b 2.2272767242843476e+50)
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* c a))))) (* 2.0 a))
(* 1.0 (- (/ c b) (/ b a)))))))double code(double a, double b, double c) {
return (((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (4.0 * ((double) (a * c)))))))))) / ((double) (2.0 * a)));
}
double code(double a, double b, double c) {
double tmp;
if ((b <= -1.277061339333756e+154)) {
tmp = ((double) ((c / b) * -1.0));
} else {
double tmp_1;
if ((b <= 1.4168306912023101e-226)) {
tmp_1 = ((double) ((4.0 / 2.0) * (c / ((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (4.0 * ((double) (c * a)))))))) - b)))));
} else {
double tmp_2;
if ((b <= 2.2272767242843476e+50)) {
tmp_2 = (((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (4.0 * ((double) (c * a)))))))))) / ((double) (2.0 * a)));
} else {
tmp_2 = ((double) (1.0 * ((double) ((c / b) - (b / a)))));
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.2 |
|---|---|
| Target | 21.2 |
| Herbie | 6.8 |
if b < -1.277061339333756e154Initial program 64.0
Taylor expanded around -inf 1.1
Simplified1.1
if -1.277061339333756e154 < b < 1.4168306912023101e-226Initial program 32.1
rmApplied flip--_binary6432.2
Simplified15.7
Simplified15.7
rmApplied *-un-lft-identity_binary6415.7
Applied times-frac_binary6415.7
Applied times-frac_binary6415.7
Simplified15.7
Simplified9.2
if 1.4168306912023101e-226 < b < 2.22727672428434759e50Initial program 8.9
if 2.22727672428434759e50 < b Initial program 38.2
Taylor expanded around inf 5.1
Simplified5.1
Final simplification6.8
herbie shell --seed 2020210
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
:herbie-expected #f
:herbie-target
(if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))