\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 -2.6627498847930204 \cdot 10^{+144}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 4.018752297937222 \cdot 10^{-218}:\\
\;\;\;\;-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.9789013216469393 \cdot 10^{+85}:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b \cdot 2}{a}\\
\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 -2.6627498847930204e+144)
(* -0.5 (* 2.0 (/ c b)))
(if (<= b 4.018752297937222e-218)
(* -0.5 (* 4.0 (/ c (- b (sqrt (- (* b b) (* 4.0 (* c a))))))))
(if (<= b 2.9789013216469393e+85)
(* -0.5 (/ (+ b (sqrt (- (* b b) (* 4.0 (* c a))))) a))
(* -0.5 (/ (* b 2.0) a))))))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 tmp;
if (b <= -2.6627498847930204e+144) {
tmp = -0.5 * (2.0 * (c / b));
} else if (b <= 4.018752297937222e-218) {
tmp = -0.5 * (4.0 * (c / (b - sqrt((b * b) - (4.0 * (c * a))))));
} else if (b <= 2.9789013216469393e+85) {
tmp = -0.5 * ((b + sqrt((b * b) - (4.0 * (c * a)))) / a);
} else {
tmp = -0.5 * ((b * 2.0) / a);
}
return tmp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.5 |
|---|---|
| Target | 20.9 |
| Herbie | 6.7 |
if b < -2.6627498847930204e144Initial program 63.3
Simplified63.3
Taylor expanded around -inf 1.6
if -2.6627498847930204e144 < b < 4.0187522979372219e-218Initial program 32.1
Simplified32.1
rmApplied flip-+_binary64_73432.2
Simplified16.0
rmApplied *-un-lft-identity_binary64_76016.0
Applied *-un-lft-identity_binary64_76016.0
Applied times-frac_binary64_76616.0
Applied times-frac_binary64_76616.0
Simplified16.0
Simplified9.3
if 4.0187522979372219e-218 < b < 2.9789013216469393e85Initial program 8.0
Simplified8.0
if 2.9789013216469393e85 < b Initial program 43.9
Simplified43.9
rmApplied flip-+_binary64_73462.5
Simplified61.7
Taylor expanded around 0 4.8
Simplified4.8
Final simplification6.7
herbie shell --seed 2020343
(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)))