\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}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 1.4168306912023101 \cdot 10^{-226}:\\
\;\;\;\;-0.5 \cdot \left(4 \cdot \frac{c}{b - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}\right)\\
\mathbf{elif}\;b \leq 2.2272767242843476 \cdot 10^{+50}:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \left(\frac{b}{a} - \frac{c}{b}\right)\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)
(* -0.5 (* 2.0 (/ c b)))
(if (<= b 1.4168306912023101e-226)
(* -0.5 (* 4.0 (/ c (- b (sqrt (- (* b b) (* 4.0 (* c a))))))))
(if (<= b 2.2272767242843476e+50)
(* -0.5 (/ (+ b (sqrt (- (* b b) (* 4.0 (* c a))))) a))
(* -0.5 (* 2.0 (- (/ b a) (/ c b))))))))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) (-0.5 * ((double) (2.0 * (c / b)))));
} else {
double tmp_1;
if ((b <= 1.4168306912023101e-226)) {
tmp_1 = ((double) (-0.5 * ((double) (4.0 * (c / ((double) (b - ((double) sqrt(((double) (((double) (b * b)) - ((double) (4.0 * ((double) (c * a)))))))))))))));
} else {
double tmp_2;
if ((b <= 2.2272767242843476e+50)) {
tmp_2 = ((double) (-0.5 * (((double) (b + ((double) sqrt(((double) (((double) (b * b)) - ((double) (4.0 * ((double) (c * a)))))))))) / a)));
} else {
tmp_2 = ((double) (-0.5 * ((double) (2.0 * ((double) ((b / a) - (c / b)))))));
}
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.9 |
if b < -1.277061339333756e154Initial program 64.0
Simplified64.0
Taylor expanded around -inf 1.1
if -1.277061339333756e154 < b < 1.4168306912023101e-226Initial program 32.1
Simplified32.1
rmApplied flip-+_binary6432.2
Simplified15.7
rmApplied *-un-lft-identity_binary6415.7
Applied *-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
Simplified8.9
if 2.22727672428434759e50 < b Initial program 38.2
Simplified38.2
Taylor expanded around inf 5.1
Simplified5.1
Final simplification6.9
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)))