\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -1.1214768270116103 \cdot 10^{+154}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{elif}\;b \le 1.199441090208904 \cdot 10^{-250}:\\
\;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} + \left(-b\right)}\\
\mathbf{elif}\;b \le 3.3389954009657566 \cdot 10^{+124}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}double f(double a, double b, double c) {
double r1231906 = b;
double r1231907 = -r1231906;
double r1231908 = r1231906 * r1231906;
double r1231909 = 4.0;
double r1231910 = a;
double r1231911 = c;
double r1231912 = r1231910 * r1231911;
double r1231913 = r1231909 * r1231912;
double r1231914 = r1231908 - r1231913;
double r1231915 = sqrt(r1231914);
double r1231916 = r1231907 - r1231915;
double r1231917 = 2.0;
double r1231918 = r1231917 * r1231910;
double r1231919 = r1231916 / r1231918;
return r1231919;
}
double f(double a, double b, double c) {
double r1231920 = b;
double r1231921 = -1.1214768270116103e+154;
bool r1231922 = r1231920 <= r1231921;
double r1231923 = c;
double r1231924 = -r1231923;
double r1231925 = r1231924 / r1231920;
double r1231926 = 1.199441090208904e-250;
bool r1231927 = r1231920 <= r1231926;
double r1231928 = 2.0;
double r1231929 = r1231928 * r1231923;
double r1231930 = r1231920 * r1231920;
double r1231931 = 4.0;
double r1231932 = a;
double r1231933 = r1231923 * r1231932;
double r1231934 = r1231931 * r1231933;
double r1231935 = r1231930 - r1231934;
double r1231936 = sqrt(r1231935);
double r1231937 = -r1231920;
double r1231938 = r1231936 + r1231937;
double r1231939 = r1231929 / r1231938;
double r1231940 = 3.3389954009657566e+124;
bool r1231941 = r1231920 <= r1231940;
double r1231942 = r1231937 - r1231936;
double r1231943 = r1231932 * r1231928;
double r1231944 = r1231942 / r1231943;
double r1231945 = r1231937 / r1231932;
double r1231946 = r1231941 ? r1231944 : r1231945;
double r1231947 = r1231927 ? r1231939 : r1231946;
double r1231948 = r1231922 ? r1231925 : r1231947;
return r1231948;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 32.8 |
|---|---|
| Target | 20.1 |
| Herbie | 6.4 |
if b < -1.1214768270116103e+154Initial program 62.9
Taylor expanded around -inf 1.5
Simplified1.5
if -1.1214768270116103e+154 < b < 1.199441090208904e-250Initial program 32.2
rmApplied *-un-lft-identity32.2
Applied *-un-lft-identity32.2
Applied distribute-lft-out--32.2
Applied associate-/l*32.2
rmApplied flip--32.3
Applied associate-/r/32.4
Applied associate-/r*32.4
Simplified32.3
Taylor expanded around 0 8.4
if 1.199441090208904e-250 < b < 3.3389954009657566e+124Initial program 7.8
if 3.3389954009657566e+124 < b Initial program 50.5
rmApplied *-un-lft-identity50.5
Applied *-un-lft-identity50.5
Applied distribute-lft-out--50.5
Applied associate-/l*50.6
Taylor expanded around 0 3.5
Simplified3.5
Final simplification6.4
herbie shell --seed 2019128
(FPCore (a b c)
:name "quadm (p42, negative)"
:herbie-target
(if (< b 0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))