\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 -8.28610472349374 \cdot 10^{+140}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \le 9.931313556234952 \cdot 10^{-296}:\\
\;\;\;\;\frac{1}{\frac{a \cdot 2}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}}\\
\mathbf{elif}\;b \le 6.523631550102089 \cdot 10^{+89}:\\
\;\;\;\;\frac{-2 \cdot c}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}double f(double a, double b, double c) {
double r5049514 = b;
double r5049515 = -r5049514;
double r5049516 = r5049514 * r5049514;
double r5049517 = 4.0;
double r5049518 = a;
double r5049519 = c;
double r5049520 = r5049518 * r5049519;
double r5049521 = r5049517 * r5049520;
double r5049522 = r5049516 - r5049521;
double r5049523 = sqrt(r5049522);
double r5049524 = r5049515 + r5049523;
double r5049525 = 2.0;
double r5049526 = r5049525 * r5049518;
double r5049527 = r5049524 / r5049526;
return r5049527;
}
double f(double a, double b, double c) {
double r5049528 = b;
double r5049529 = -8.28610472349374e+140;
bool r5049530 = r5049528 <= r5049529;
double r5049531 = c;
double r5049532 = r5049531 / r5049528;
double r5049533 = a;
double r5049534 = r5049528 / r5049533;
double r5049535 = r5049532 - r5049534;
double r5049536 = 9.931313556234952e-296;
bool r5049537 = r5049528 <= r5049536;
double r5049538 = 1.0;
double r5049539 = 2.0;
double r5049540 = r5049533 * r5049539;
double r5049541 = r5049528 * r5049528;
double r5049542 = 4.0;
double r5049543 = r5049542 * r5049533;
double r5049544 = r5049543 * r5049531;
double r5049545 = r5049541 - r5049544;
double r5049546 = sqrt(r5049545);
double r5049547 = r5049546 - r5049528;
double r5049548 = r5049540 / r5049547;
double r5049549 = r5049538 / r5049548;
double r5049550 = 6.523631550102089e+89;
bool r5049551 = r5049528 <= r5049550;
double r5049552 = -2.0;
double r5049553 = r5049552 * r5049531;
double r5049554 = r5049531 * r5049533;
double r5049555 = r5049554 * r5049542;
double r5049556 = r5049541 - r5049555;
double r5049557 = sqrt(r5049556);
double r5049558 = r5049557 + r5049528;
double r5049559 = r5049553 / r5049558;
double r5049560 = -r5049532;
double r5049561 = r5049551 ? r5049559 : r5049560;
double r5049562 = r5049537 ? r5049549 : r5049561;
double r5049563 = r5049530 ? r5049535 : r5049562;
return r5049563;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.0 |
|---|---|
| Target | 20.1 |
| Herbie | 6.6 |
if b < -8.28610472349374e+140Initial program 55.8
Simplified55.8
Taylor expanded around -inf 1.6
if -8.28610472349374e+140 < b < 9.931313556234952e-296Initial program 8.7
Simplified8.7
rmApplied *-un-lft-identity8.7
Applied *-un-lft-identity8.7
Applied distribute-lft-out--8.7
Applied associate-/l*8.9
if 9.931313556234952e-296 < b < 6.523631550102089e+89Initial program 32.6
Simplified32.6
rmApplied *-un-lft-identity32.6
Applied *-un-lft-identity32.6
Applied distribute-lft-out--32.6
Applied associate-/l*32.7
rmApplied flip--32.7
Applied associate-/r/32.8
Applied add-cube-cbrt32.8
Applied times-frac32.8
Simplified16.5
Simplified16.4
Taylor expanded around inf 9.3
rmApplied un-div-inv9.2
if 6.523631550102089e+89 < b Initial program 58.7
Simplified58.7
Taylor expanded around inf 2.6
Simplified2.6
Final simplification6.6
herbie shell --seed 2019112
(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)))