\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.566759220787537 \cdot 10^{+83}:\\
\;\;\;\;-\frac{c}{b}\\
\mathbf{elif}\;b \leq 8.005947987748499 \cdot 10^{-240}:\\
\;\;\;\;2 \cdot \frac{c}{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}\\
\mathbf{elif}\;b \leq 6.914177626537424 \cdot 10^{+129}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-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 -5.566759220787537e+83)
(- (/ c b))
(if (<= b 8.005947987748499e-240)
(* 2.0 (/ c (- (sqrt (- (* b b) (* 4.0 (* c a)))) b)))
(if (<= b 6.914177626537424e+129)
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* c a))))) (* 2.0 a))
(/ (- 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 <= -5.566759220787537e+83) {
tmp = -(c / b);
} else if (b <= 8.005947987748499e-240) {
tmp = 2.0 * (c / (sqrt((b * b) - (4.0 * (c * a))) - b));
} else if (b <= 6.914177626537424e+129) {
tmp = (-b - sqrt((b * b) - (4.0 * (c * a)))) / (2.0 * a);
} else {
tmp = -b / a;
}
return tmp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.1 |
|---|---|
| Target | 21.0 |
| Herbie | 6.8 |
if b < -5.5667592207875366e83Initial program 59.0
Taylor expanded around -inf 2.6
Simplified2.6
if -5.5667592207875366e83 < b < 8.00594798774849923e-240Initial program 30.0
rmApplied flip--_binary6430.1
Simplified16.9
Simplified16.9
rmApplied *-un-lft-identity_binary6416.9
Applied times-frac_binary6416.9
Applied times-frac_binary6416.9
Simplified16.9
Simplified10.2
if 8.00594798774849923e-240 < b < 6.9141776265374237e129Initial program 8.1
if 6.9141776265374237e129 < b Initial program 54.7
rmApplied flip--_binary6463.7
Simplified62.6
Simplified62.6
Taylor expanded around 0 3.0
Simplified3.0
Final simplification6.8
herbie shell --seed 2020273
(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)))