\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 -3.263941314600607 \cdot 10^{+152}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \le -4.687918346756617 \cdot 10^{-254}:\\
\;\;\;\;\frac{\left(\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b\right) \cdot \frac{1}{2}}{a}\\
\mathbf{elif}\;b \le 1.817261397602966 \cdot 10^{+121}:\\
\;\;\;\;\frac{c \cdot -2}{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} + b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -2}{\left(b - \frac{c}{b} \cdot a\right) \cdot 2}\\
\end{array}double f(double a, double b, double c) {
double r5890034 = b;
double r5890035 = -r5890034;
double r5890036 = r5890034 * r5890034;
double r5890037 = 4.0;
double r5890038 = a;
double r5890039 = c;
double r5890040 = r5890038 * r5890039;
double r5890041 = r5890037 * r5890040;
double r5890042 = r5890036 - r5890041;
double r5890043 = sqrt(r5890042);
double r5890044 = r5890035 + r5890043;
double r5890045 = 2.0;
double r5890046 = r5890045 * r5890038;
double r5890047 = r5890044 / r5890046;
return r5890047;
}
double f(double a, double b, double c) {
double r5890048 = b;
double r5890049 = -3.263941314600607e+152;
bool r5890050 = r5890048 <= r5890049;
double r5890051 = c;
double r5890052 = r5890051 / r5890048;
double r5890053 = a;
double r5890054 = r5890048 / r5890053;
double r5890055 = r5890052 - r5890054;
double r5890056 = -4.687918346756617e-254;
bool r5890057 = r5890048 <= r5890056;
double r5890058 = r5890048 * r5890048;
double r5890059 = 4.0;
double r5890060 = r5890053 * r5890059;
double r5890061 = r5890060 * r5890051;
double r5890062 = r5890058 - r5890061;
double r5890063 = sqrt(r5890062);
double r5890064 = r5890063 - r5890048;
double r5890065 = 0.5;
double r5890066 = r5890064 * r5890065;
double r5890067 = r5890066 / r5890053;
double r5890068 = 1.817261397602966e+121;
bool r5890069 = r5890048 <= r5890068;
double r5890070 = -2.0;
double r5890071 = r5890051 * r5890070;
double r5890072 = r5890063 + r5890048;
double r5890073 = r5890071 / r5890072;
double r5890074 = r5890052 * r5890053;
double r5890075 = r5890048 - r5890074;
double r5890076 = 2.0;
double r5890077 = r5890075 * r5890076;
double r5890078 = r5890071 / r5890077;
double r5890079 = r5890069 ? r5890073 : r5890078;
double r5890080 = r5890057 ? r5890067 : r5890079;
double r5890081 = r5890050 ? r5890055 : r5890080;
return r5890081;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.3 |
|---|---|
| Target | 20.3 |
| Herbie | 6.4 |
if b < -3.263941314600607e+152Initial program 60.1
Simplified60.1
rmApplied div-inv60.1
Simplified60.1
Taylor expanded around -inf 2.3
if -3.263941314600607e+152 < b < -4.687918346756617e-254Initial program 7.8
Simplified7.8
rmApplied div-inv8.0
Simplified8.0
rmApplied associate-*r/7.8
if -4.687918346756617e-254 < b < 1.817261397602966e+121Initial program 31.6
Simplified31.6
rmApplied div-inv31.7
Simplified31.7
rmApplied flip--31.8
Applied associate-*l/31.8
Simplified14.4
Taylor expanded around -inf 8.7
if 1.817261397602966e+121 < b Initial program 59.8
Simplified59.8
rmApplied div-inv59.8
Simplified59.8
rmApplied flip--59.9
Applied associate-*l/59.9
Simplified33.2
Taylor expanded around -inf 32.8
Taylor expanded around inf 7.3
Simplified2.3
Final simplification6.4
herbie shell --seed 2019128
(FPCore (a b c)
:name "quadp (p42, positive)"
:herbie-target
(if (< b 0) (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))))
(/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))