\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.6495164398004875 \cdot 10^{+103}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 9.402708844729834 \cdot 10^{-273}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}\\
\mathbf{elif}\;b \leq 2.675726436471294 \cdot 10^{+140}:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{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.6495164398004875e+103)
(* -0.5 (* 2.0 (/ c b)))
(if (<= b 9.402708844729834e-273)
(* -0.5 (/ (* c 4.0) (- b (sqrt (- (* b b) (* 4.0 (* c a)))))))
(if (<= b 2.675726436471294e+140)
(* -0.5 (/ (+ b (sqrt (- (* b b) (* 4.0 (* c a))))) a))
(* -0.5 (/ (+ b b) 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.6495164398004875e+103) {
tmp = -0.5 * (2.0 * (c / b));
} else if (b <= 9.402708844729834e-273) {
tmp = -0.5 * ((c * 4.0) / (b - sqrt((b * b) - (4.0 * (c * a)))));
} else if (b <= 2.675726436471294e+140) {
tmp = -0.5 * ((b + sqrt((b * b) - (4.0 * (c * a)))) / a);
} else {
tmp = -0.5 * ((b + b) / a);
}
return tmp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.5 |
|---|---|
| Target | 21.2 |
| Herbie | 6.5 |
if b < -2.64951643980048754e103Initial program 59.4
Simplified59.4
Taylor expanded around -inf 2.5
if -2.64951643980048754e103 < b < 9.4027088447298342e-273Initial program 32.0
Simplified32.0
rmApplied div-inv_binary64_75732.0
rmApplied flip-+_binary64_73432.0
Applied associate-*l/_binary64_70332.1
Simplified15.9
Taylor expanded around 0 8.9
if 9.4027088447298342e-273 < b < 2.675726436471294e140Initial program 8.3
Simplified8.4
if 2.675726436471294e140 < b Initial program 58.6
Simplified58.6
Taylor expanded around inf 3.5
Final simplification6.5
herbie shell --seed 2021060
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
: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)))