\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 -6.063829179971075 \cdot 10^{+73}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq -6.510183985272386 \cdot 10^{-301}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}\\
\mathbf{elif}\;b \leq 7.922796939806533 \cdot 10^{+99}:\\
\;\;\;\;-0.5 \cdot \left(\left(b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right) \cdot \frac{1}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{b}{a}\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 -6.063829179971075e+73)
(* -0.5 (* 2.0 (/ c b)))
(if (<= b -6.510183985272386e-301)
(* -0.5 (/ (* c 4.0) (- b (sqrt (- (* b b) (* 4.0 (* c a)))))))
(if (<= b 7.922796939806533e+99)
(* -0.5 (* (+ b (sqrt (- (* b b) (* 4.0 (* c a))))) (/ 1.0 a)))
(* -0.5 (* 2.0 (/ 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 <= -6.063829179971075e+73) {
tmp = -0.5 * (2.0 * (c / b));
} else if (b <= -6.510183985272386e-301) {
tmp = -0.5 * ((c * 4.0) / (b - sqrt((b * b) - (4.0 * (c * a)))));
} else if (b <= 7.922796939806533e+99) {
tmp = -0.5 * ((b + sqrt((b * b) - (4.0 * (c * a)))) * (1.0 / a));
} else {
tmp = -0.5 * (2.0 * (b / a));
}
return tmp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.9 |
|---|---|
| Target | 20.5 |
| Herbie | 6.6 |
if b < -6.06382917997107451e73Initial program 57.6
Simplified57.6
Taylor expanded around -inf 3.2
if -6.06382917997107451e73 < b < -6.5101839852723858e-301Initial program 31.2
Simplified31.1
rmApplied div-inv_binary64_76431.2
rmApplied flip-+_binary64_74131.2
Applied associate-*l/_binary64_71031.2
Simplified15.2
rmApplied *-un-lft-identity_binary64_76715.2
Applied times-frac_binary64_77315.2
Simplified15.2
Simplified8.2
if -6.5101839852723858e-301 < b < 7.92279693980653335e99Initial program 9.3
Simplified9.3
rmApplied div-inv_binary64_7649.5
if 7.92279693980653335e99 < b Initial program 47.6
Simplified47.6
rmApplied div-inv_binary64_76447.7
rmApplied flip-+_binary64_74163.5
Applied associate-*l/_binary64_71063.5
Simplified62.6
rmApplied *-un-lft-identity_binary64_76762.6
Applied times-frac_binary64_77362.6
Simplified62.6
Simplified62.4
Taylor expanded around 0 3.6
Final simplification6.6
herbie shell --seed 2020281
(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)))