\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.229623884976429 \cdot 10^{-265}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)} - b}{a}}{2}\\
\mathbf{elif}\;b \le 1.3483090680597456 \cdot 10^{+92}:\\
\;\;\;\;\frac{\frac{c \cdot -4}{b + \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(a, c \cdot -4, 0\right)}{a}}{b + b}}{2}\\
\end{array}double f(double a, double b, double c) {
double r1831546 = b;
double r1831547 = -r1831546;
double r1831548 = r1831546 * r1831546;
double r1831549 = 4.0;
double r1831550 = a;
double r1831551 = c;
double r1831552 = r1831550 * r1831551;
double r1831553 = r1831549 * r1831552;
double r1831554 = r1831548 - r1831553;
double r1831555 = sqrt(r1831554);
double r1831556 = r1831547 + r1831555;
double r1831557 = 2.0;
double r1831558 = r1831557 * r1831550;
double r1831559 = r1831556 / r1831558;
return r1831559;
}
double f(double a, double b, double c) {
double r1831560 = b;
double r1831561 = -5.229623884976429e-265;
bool r1831562 = r1831560 <= r1831561;
double r1831563 = -4.0;
double r1831564 = a;
double r1831565 = r1831563 * r1831564;
double r1831566 = c;
double r1831567 = r1831560 * r1831560;
double r1831568 = fma(r1831565, r1831566, r1831567);
double r1831569 = sqrt(r1831568);
double r1831570 = r1831569 - r1831560;
double r1831571 = r1831570 / r1831564;
double r1831572 = 2.0;
double r1831573 = r1831571 / r1831572;
double r1831574 = 1.3483090680597456e+92;
bool r1831575 = r1831560 <= r1831574;
double r1831576 = r1831566 * r1831563;
double r1831577 = r1831566 * r1831564;
double r1831578 = fma(r1831577, r1831563, r1831567);
double r1831579 = sqrt(r1831578);
double r1831580 = r1831560 + r1831579;
double r1831581 = r1831576 / r1831580;
double r1831582 = r1831581 / r1831572;
double r1831583 = 0.0;
double r1831584 = fma(r1831564, r1831576, r1831583);
double r1831585 = r1831584 / r1831564;
double r1831586 = r1831560 + r1831560;
double r1831587 = r1831585 / r1831586;
double r1831588 = r1831587 / r1831572;
double r1831589 = r1831575 ? r1831582 : r1831588;
double r1831590 = r1831562 ? r1831573 : r1831589;
return r1831590;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 33.4 |
|---|---|
| Target | 20.6 |
| Herbie | 14.6 |
if b < -5.229623884976429e-265Initial program 22.2
Simplified22.2
rmApplied clear-num22.3
rmApplied *-un-lft-identity22.3
Applied *-un-lft-identity22.3
Applied times-frac22.3
Applied add-cube-cbrt22.3
Applied times-frac22.3
Simplified22.3
Simplified22.2
if -5.229623884976429e-265 < b < 1.3483090680597456e+92Initial program 30.2
Simplified30.2
rmApplied clear-num30.2
rmApplied flip--30.3
Applied associate-/r/30.4
Applied associate-/r*30.5
Simplified15.3
Taylor expanded around 0 9.0
if 1.3483090680597456e+92 < b Initial program 57.6
Simplified57.6
rmApplied clear-num57.6
rmApplied flip--57.7
Applied associate-/r/57.7
Applied associate-/r*57.7
Simplified29.5
Taylor expanded around 0 8.7
Final simplification14.6
herbie shell --seed 2019146 +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)))