\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 -9.026475235538753 \cdot 10^{-68}:\\
\;\;\;\;-\frac{c}{b}\\
\mathbf{elif}\;b \le 2.850331809009435 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{-1}{2} \cdot \left(\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*} + b\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}double f(double a, double b, double c) {
double r13490625 = b;
double r13490626 = -r13490625;
double r13490627 = r13490625 * r13490625;
double r13490628 = 4.0;
double r13490629 = a;
double r13490630 = c;
double r13490631 = r13490629 * r13490630;
double r13490632 = r13490628 * r13490631;
double r13490633 = r13490627 - r13490632;
double r13490634 = sqrt(r13490633);
double r13490635 = r13490626 - r13490634;
double r13490636 = 2.0;
double r13490637 = r13490636 * r13490629;
double r13490638 = r13490635 / r13490637;
return r13490638;
}
double f(double a, double b, double c) {
double r13490639 = b;
double r13490640 = -9.026475235538753e-68;
bool r13490641 = r13490639 <= r13490640;
double r13490642 = c;
double r13490643 = r13490642 / r13490639;
double r13490644 = -r13490643;
double r13490645 = 2.850331809009435e+96;
bool r13490646 = r13490639 <= r13490645;
double r13490647 = -0.5;
double r13490648 = a;
double r13490649 = -4.0;
double r13490650 = r13490642 * r13490649;
double r13490651 = r13490639 * r13490639;
double r13490652 = fma(r13490648, r13490650, r13490651);
double r13490653 = sqrt(r13490652);
double r13490654 = r13490653 + r13490639;
double r13490655 = r13490647 * r13490654;
double r13490656 = r13490655 / r13490648;
double r13490657 = -r13490639;
double r13490658 = r13490657 / r13490648;
double r13490659 = r13490646 ? r13490656 : r13490658;
double r13490660 = r13490641 ? r13490644 : r13490659;
return r13490660;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.6 |
|---|---|
| Target | 20.7 |
| Herbie | 9.5 |
if b < -9.026475235538753e-68Initial program 53.5
Simplified53.5
Taylor expanded around -inf 53.5
Simplified53.5
Taylor expanded around -inf 8.3
Simplified8.3
if -9.026475235538753e-68 < b < 2.850331809009435e+96Initial program 12.6
Simplified12.6
rmApplied *-un-lft-identity12.6
Applied div-inv12.6
Applied times-frac12.7
Simplified12.7
Simplified12.7
rmApplied associate-*r/12.6
if 2.850331809009435e+96 < b Initial program 43.5
Simplified43.5
Taylor expanded around -inf 43.5
Simplified43.5
rmApplied *-un-lft-identity43.5
Applied *-un-lft-identity43.5
Applied *-un-lft-identity43.5
Applied distribute-lft-out--43.5
Applied times-frac43.5
Applied associate-/l*43.6
Simplified43.6
Taylor expanded around 0 4.1
Simplified4.1
Final simplification9.5
herbie shell --seed 2019104 +o rules:numerics
(FPCore (a b c)
:name "quadm (p42, negative)"
:herbie-target
(if (< b 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)))