\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 -5.730935129370623 \cdot 10^{+90}:\\
\;\;\;\;-0.5 \cdot \left(4 \cdot \frac{c}{b + b}\right)\\
\mathbf{elif}\;b \leq 1.0559784740032639 \cdot 10^{-278}:\\
\;\;\;\;-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 5.243928485852795 \cdot 10^{+74}:\\
\;\;\;\;-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 -5.730935129370623e+90)
(* -0.5 (* 4.0 (/ c (+ b b))))
(if (<= b 1.0559784740032639e-278)
(* -0.5 (* 4.0 (/ c (- b (sqrt (- (* b b) (* 4.0 (* c a))))))))
(if (<= b 5.243928485852795e+74)
(* -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 (-b - sqrt((b * b) - (4.0 * (a * c)))) / (2.0 * a);
}
double code(double a, double b, double c) {
double tmp;
if (b <= -5.730935129370623e+90) {
tmp = -0.5 * (4.0 * (c / (b + b)));
} else if (b <= 1.0559784740032639e-278) {
tmp = -0.5 * (4.0 * (c / (b - sqrt((b * b) - (4.0 * (c * a))))));
} else if (b <= 5.243928485852795e+74) {
tmp = -0.5 * ((b + sqrt((b * b) - (4.0 * (c * a)))) / a);
} else {
tmp = -0.5 * (2.0 * ((b / a) - (c / b)));
}
return tmp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.5 |
|---|---|
| Target | 20.8 |
| Herbie | 7.0 |
if b < -5.730935129370623e90Initial program 58.7
Simplified58.7
rmApplied flip-+_binary6458.7
Simplified30.5
rmApplied *-un-lft-identity_binary6430.5
Applied *-un-lft-identity_binary6430.5
Applied times-frac_binary6430.5
Applied times-frac_binary6430.5
Simplified30.5
Simplified28.4
Taylor expanded around -inf 2.5
if -5.730935129370623e90 < b < 1.05597847400326391e-278Initial program 30.6
Simplified30.6
rmApplied flip-+_binary6430.6
Simplified17.0
rmApplied *-un-lft-identity_binary6417.0
Applied *-un-lft-identity_binary6417.0
Applied times-frac_binary6417.0
Applied times-frac_binary6417.0
Simplified17.0
Simplified9.7
if 1.05597847400326391e-278 < b < 5.2439284858527951e74Initial program 9.8
Simplified9.8
rmApplied *-un-lft-identity_binary649.8
Applied associate-/r*_binary649.8
if 5.2439284858527951e74 < b Initial program 41.2
Simplified41.2
Taylor expanded around inf 4.0
Simplified4.0
Final simplification7.0
herbie shell --seed 2021126
(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)))