\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 -2.1144981103869975 \cdot 10^{+131}:\\
\;\;\;\;\frac{\left(\frac{c}{b} - \frac{b}{a}\right) \cdot 2}{2}\\
\mathbf{elif}\;b \le -9.252735565156383 \cdot 10^{-297}:\\
\;\;\;\;\frac{\frac{1}{\frac{a}{\sqrt{\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)} - b}}}{2}\\
\mathbf{elif}\;b \le 5.6843076821754435 \cdot 10^{+85}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)} + b} \cdot \left(-4 \cdot c\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{c}{b} \cdot -2}{2}\\
\end{array}double f(double a, double b, double c) {
double r3178771 = b;
double r3178772 = -r3178771;
double r3178773 = r3178771 * r3178771;
double r3178774 = 4.0;
double r3178775 = a;
double r3178776 = c;
double r3178777 = r3178775 * r3178776;
double r3178778 = r3178774 * r3178777;
double r3178779 = r3178773 - r3178778;
double r3178780 = sqrt(r3178779);
double r3178781 = r3178772 + r3178780;
double r3178782 = 2.0;
double r3178783 = r3178782 * r3178775;
double r3178784 = r3178781 / r3178783;
return r3178784;
}
double f(double a, double b, double c) {
double r3178785 = b;
double r3178786 = -2.1144981103869975e+131;
bool r3178787 = r3178785 <= r3178786;
double r3178788 = c;
double r3178789 = r3178788 / r3178785;
double r3178790 = a;
double r3178791 = r3178785 / r3178790;
double r3178792 = r3178789 - r3178791;
double r3178793 = 2.0;
double r3178794 = r3178792 * r3178793;
double r3178795 = r3178794 / r3178793;
double r3178796 = -9.252735565156383e-297;
bool r3178797 = r3178785 <= r3178796;
double r3178798 = 1.0;
double r3178799 = -4.0;
double r3178800 = r3178790 * r3178788;
double r3178801 = r3178785 * r3178785;
double r3178802 = fma(r3178799, r3178800, r3178801);
double r3178803 = sqrt(r3178802);
double r3178804 = r3178803 - r3178785;
double r3178805 = r3178790 / r3178804;
double r3178806 = r3178798 / r3178805;
double r3178807 = r3178806 / r3178793;
double r3178808 = 5.6843076821754435e+85;
bool r3178809 = r3178785 <= r3178808;
double r3178810 = r3178803 + r3178785;
double r3178811 = r3178798 / r3178810;
double r3178812 = r3178799 * r3178788;
double r3178813 = r3178811 * r3178812;
double r3178814 = r3178813 / r3178793;
double r3178815 = -2.0;
double r3178816 = r3178789 * r3178815;
double r3178817 = r3178816 / r3178793;
double r3178818 = r3178809 ? r3178814 : r3178817;
double r3178819 = r3178797 ? r3178807 : r3178818;
double r3178820 = r3178787 ? r3178795 : r3178819;
return r3178820;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.6 |
|---|---|
| Target | 21.0 |
| Herbie | 6.9 |
if b < -2.1144981103869975e+131Initial program 53.8
Simplified53.7
rmApplied *-un-lft-identity53.7
Applied associate-/r*53.7
Simplified53.7
Taylor expanded around -inf 2.6
Simplified2.6
if -2.1144981103869975e+131 < b < -9.252735565156383e-297Initial program 8.7
Simplified8.7
rmApplied clear-num8.9
if -9.252735565156383e-297 < b < 5.6843076821754435e+85Initial program 30.7
Simplified30.7
rmApplied clear-num30.7
rmApplied flip--30.9
Applied associate-/r/30.9
Applied *-un-lft-identity30.9
Applied times-frac30.9
Simplified16.2
Taylor expanded around 0 10.0
if 5.6843076821754435e+85 < b Initial program 58.0
Simplified58.0
rmApplied *-un-lft-identity58.0
Applied associate-/r*58.0
Simplified58.0
Taylor expanded around inf 2.6
Final simplification6.9
herbie shell --seed 2019163 +o rules:numerics
(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)))