\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.840382544825149510322162525528307154775 \cdot 10^{46}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le -7.877985662156598668725484528840176897607 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - b \cdot b\right) + a \cdot \left(4 \cdot c\right)}{a}}{2}}{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} + \left(-b\right)}\\
\mathbf{elif}\;b \le -6.596302400897661869317839215315745353488 \cdot 10^{-136}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 7.501979458872916117674264090696641915837 \cdot 10^{77}:\\
\;\;\;\;-\left(\frac{\frac{b}{a}}{2} + \frac{\sqrt{b \cdot b - a \cdot \left(4 \cdot c\right)}}{2 \cdot a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 \cdot b}{a}\\
\end{array}double f(double a, double b, double c) {
double r52927 = b;
double r52928 = -r52927;
double r52929 = r52927 * r52927;
double r52930 = 4.0;
double r52931 = a;
double r52932 = c;
double r52933 = r52931 * r52932;
double r52934 = r52930 * r52933;
double r52935 = r52929 - r52934;
double r52936 = sqrt(r52935);
double r52937 = r52928 - r52936;
double r52938 = 2.0;
double r52939 = r52938 * r52931;
double r52940 = r52937 / r52939;
return r52940;
}
double f(double a, double b, double c) {
double r52941 = b;
double r52942 = -5.84038254482515e+46;
bool r52943 = r52941 <= r52942;
double r52944 = -1.0;
double r52945 = c;
double r52946 = r52945 / r52941;
double r52947 = r52944 * r52946;
double r52948 = -7.877985662156599e-94;
bool r52949 = r52941 <= r52948;
double r52950 = r52941 * r52941;
double r52951 = r52950 - r52950;
double r52952 = a;
double r52953 = 4.0;
double r52954 = r52953 * r52945;
double r52955 = r52952 * r52954;
double r52956 = r52951 + r52955;
double r52957 = r52956 / r52952;
double r52958 = 2.0;
double r52959 = r52957 / r52958;
double r52960 = r52945 * r52952;
double r52961 = r52953 * r52960;
double r52962 = r52950 - r52961;
double r52963 = sqrt(r52962);
double r52964 = -r52941;
double r52965 = r52963 + r52964;
double r52966 = r52959 / r52965;
double r52967 = -6.596302400897662e-136;
bool r52968 = r52941 <= r52967;
double r52969 = 7.501979458872916e+77;
bool r52970 = r52941 <= r52969;
double r52971 = r52941 / r52952;
double r52972 = r52971 / r52958;
double r52973 = r52950 - r52955;
double r52974 = sqrt(r52973);
double r52975 = r52958 * r52952;
double r52976 = r52974 / r52975;
double r52977 = r52972 + r52976;
double r52978 = -r52977;
double r52979 = r52944 * r52941;
double r52980 = r52979 / r52952;
double r52981 = r52970 ? r52978 : r52980;
double r52982 = r52968 ? r52947 : r52981;
double r52983 = r52949 ? r52966 : r52982;
double r52984 = r52943 ? r52947 : r52983;
return r52984;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.2 |
|---|---|
| Target | 21.2 |
| Herbie | 10.0 |
if b < -5.84038254482515e+46 or -7.877985662156599e-94 < b < -6.596302400897662e-136Initial program 54.4
Simplified54.4
Taylor expanded around -inf 8.4
if -5.84038254482515e+46 < b < -7.877985662156599e-94Initial program 40.2
Simplified40.2
rmApplied clear-num40.2
rmApplied div-inv40.3
Applied add-cube-cbrt40.3
Applied times-frac40.3
Simplified40.3
Simplified40.2
rmApplied flip--40.3
Applied associate-*r/40.3
Simplified14.8
if -6.596302400897662e-136 < b < 7.501979458872916e+77Initial program 12.1
Simplified12.0
rmApplied clear-num12.1
rmApplied div-inv12.2
Applied add-cube-cbrt12.2
Applied times-frac12.2
Simplified12.2
Simplified12.2
rmApplied sub-neg12.2
Applied distribute-lft-in12.2
Simplified12.2
Simplified12.0
if 7.501979458872916e+77 < b Initial program 42.5
Simplified42.5
rmApplied clear-num42.6
rmApplied div-inv42.7
Applied add-cube-cbrt42.7
Applied times-frac42.7
Simplified42.7
Simplified42.6
Taylor expanded around 0 5.1
Simplified5.1
Final simplification10.0
herbie shell --seed 2019196
(FPCore (a b c)
:name "quadm (p42, negative)"
: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)))