\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 -5.92145859080318459 \cdot 10^{30}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le -1.35303540148363475 \cdot 10^{-114}:\\
\;\;\;\;\frac{-b}{2 \cdot a} - \frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\
\mathbf{elif}\;b \le -3.70403707285546 \cdot 10^{-127}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 2.3866645776898725 \cdot 10^{85}:\\
\;\;\;\;\frac{-b}{2 \cdot a} - \frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{b}{a}\\
\end{array}double f(double a, double b, double c) {
double r87863 = b;
double r87864 = -r87863;
double r87865 = r87863 * r87863;
double r87866 = 4.0;
double r87867 = a;
double r87868 = c;
double r87869 = r87867 * r87868;
double r87870 = r87866 * r87869;
double r87871 = r87865 - r87870;
double r87872 = sqrt(r87871);
double r87873 = r87864 - r87872;
double r87874 = 2.0;
double r87875 = r87874 * r87867;
double r87876 = r87873 / r87875;
return r87876;
}
double f(double a, double b, double c) {
double r87877 = b;
double r87878 = -5.921458590803185e+30;
bool r87879 = r87877 <= r87878;
double r87880 = -1.0;
double r87881 = c;
double r87882 = r87881 / r87877;
double r87883 = r87880 * r87882;
double r87884 = -1.3530354014836348e-114;
bool r87885 = r87877 <= r87884;
double r87886 = -r87877;
double r87887 = 2.0;
double r87888 = a;
double r87889 = r87887 * r87888;
double r87890 = r87886 / r87889;
double r87891 = r87877 * r87877;
double r87892 = 4.0;
double r87893 = r87888 * r87881;
double r87894 = r87892 * r87893;
double r87895 = r87891 - r87894;
double r87896 = sqrt(r87895);
double r87897 = r87896 / r87889;
double r87898 = r87890 - r87897;
double r87899 = -3.704037072855455e-127;
bool r87900 = r87877 <= r87899;
double r87901 = 2.3866645776898725e+85;
bool r87902 = r87877 <= r87901;
double r87903 = r87877 / r87888;
double r87904 = r87880 * r87903;
double r87905 = r87902 ? r87898 : r87904;
double r87906 = r87900 ? r87883 : r87905;
double r87907 = r87885 ? r87898 : r87906;
double r87908 = r87879 ? r87883 : r87907;
return r87908;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.0 |
|---|---|
| Target | 21.2 |
| Herbie | 11.7 |
if b < -5.921458590803185e+30 or -1.3530354014836348e-114 < b < -3.704037072855455e-127Initial program 56.0
Taylor expanded around -inf 6.0
if -5.921458590803185e+30 < b < -1.3530354014836348e-114 or -3.704037072855455e-127 < b < 2.3866645776898725e+85Initial program 17.6
rmApplied div-sub17.6
if 2.3866645776898725e+85 < b Initial program 43.7
rmApplied clear-num43.8
Taylor expanded around 0 3.8
Final simplification11.7
herbie shell --seed 2020039 +o rules:numerics
(FPCore (a b c)
:name "The quadratic formula (r2)"
:precision binary64
:herbie-target
(if (< b 0.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)))