\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 -8.260729798395838 \cdot 10^{-43}:\\
\;\;\;\;1 \cdot \left(-1 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \le 1.67643144401154069 \cdot 10^{104}:\\
\;\;\;\;1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\right)\\
\end{array}double f(double a, double b, double c) {
double r102899 = b;
double r102900 = -r102899;
double r102901 = r102899 * r102899;
double r102902 = 4.0;
double r102903 = a;
double r102904 = c;
double r102905 = r102903 * r102904;
double r102906 = r102902 * r102905;
double r102907 = r102901 - r102906;
double r102908 = sqrt(r102907);
double r102909 = r102900 - r102908;
double r102910 = 2.0;
double r102911 = r102910 * r102903;
double r102912 = r102909 / r102911;
return r102912;
}
double f(double a, double b, double c) {
double r102913 = b;
double r102914 = -8.260729798395838e-43;
bool r102915 = r102913 <= r102914;
double r102916 = 1.0;
double r102917 = -1.0;
double r102918 = c;
double r102919 = r102918 / r102913;
double r102920 = r102917 * r102919;
double r102921 = r102916 * r102920;
double r102922 = 1.6764314440115407e+104;
bool r102923 = r102913 <= r102922;
double r102924 = -r102913;
double r102925 = r102913 * r102913;
double r102926 = 4.0;
double r102927 = a;
double r102928 = r102927 * r102918;
double r102929 = r102926 * r102928;
double r102930 = r102925 - r102929;
double r102931 = sqrt(r102930);
double r102932 = r102924 - r102931;
double r102933 = 2.0;
double r102934 = r102933 * r102927;
double r102935 = r102932 / r102934;
double r102936 = r102916 * r102935;
double r102937 = 1.0;
double r102938 = r102913 / r102927;
double r102939 = r102919 - r102938;
double r102940 = r102937 * r102939;
double r102941 = r102916 * r102940;
double r102942 = r102923 ? r102936 : r102941;
double r102943 = r102915 ? r102921 : r102942;
return r102943;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.1 |
|---|---|
| Target | 21.1 |
| Herbie | 9.9 |
if b < -8.260729798395838e-43Initial program 54.7
rmApplied div-inv54.7
rmApplied *-un-lft-identity54.7
Applied associate-*l*54.7
Simplified54.7
Taylor expanded around -inf 7.3
if -8.260729798395838e-43 < b < 1.6764314440115407e+104Initial program 14.0
rmApplied div-inv14.1
rmApplied *-un-lft-identity14.1
Applied associate-*l*14.1
Simplified14.0
if 1.6764314440115407e+104 < b Initial program 47.9
rmApplied div-inv48.0
rmApplied *-un-lft-identity48.0
Applied associate-*l*48.0
Simplified47.9
Taylor expanded around inf 3.3
Simplified3.3
Final simplification9.9
herbie shell --seed 2020024 +o rules:numerics
(FPCore (a b c)
:name "quadm (p42, negative)"
: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)))