\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -9.088000531423294 \cdot 10^{+152}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \le 9.354082991670835 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{a}}{2} - \frac{\frac{b}{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}double f(double a, double b, double c) {
double r1647009 = b;
double r1647010 = -r1647009;
double r1647011 = r1647009 * r1647009;
double r1647012 = 4.0;
double r1647013 = a;
double r1647014 = r1647012 * r1647013;
double r1647015 = c;
double r1647016 = r1647014 * r1647015;
double r1647017 = r1647011 - r1647016;
double r1647018 = sqrt(r1647017);
double r1647019 = r1647010 + r1647018;
double r1647020 = 2.0;
double r1647021 = r1647020 * r1647013;
double r1647022 = r1647019 / r1647021;
return r1647022;
}
double f(double a, double b, double c) {
double r1647023 = b;
double r1647024 = -9.088000531423294e+152;
bool r1647025 = r1647023 <= r1647024;
double r1647026 = c;
double r1647027 = r1647026 / r1647023;
double r1647028 = a;
double r1647029 = r1647023 / r1647028;
double r1647030 = r1647027 - r1647029;
double r1647031 = 9.354082991670835e-125;
bool r1647032 = r1647023 <= r1647031;
double r1647033 = r1647023 * r1647023;
double r1647034 = r1647026 * r1647028;
double r1647035 = 4.0;
double r1647036 = r1647034 * r1647035;
double r1647037 = r1647033 - r1647036;
double r1647038 = sqrt(r1647037);
double r1647039 = r1647038 / r1647028;
double r1647040 = 2.0;
double r1647041 = r1647039 / r1647040;
double r1647042 = r1647029 / r1647040;
double r1647043 = r1647041 - r1647042;
double r1647044 = -r1647027;
double r1647045 = r1647032 ? r1647043 : r1647044;
double r1647046 = r1647025 ? r1647030 : r1647045;
return r1647046;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 32.9 |
|---|---|
| Target | 20.3 |
| Herbie | 10.3 |
if b < -9.088000531423294e+152Initial program 60.4
Simplified60.4
rmApplied *-un-lft-identity60.4
Applied div-inv60.4
Applied times-frac60.4
Simplified60.4
Taylor expanded around -inf 1.5
if -9.088000531423294e+152 < b < 9.354082991670835e-125Initial program 10.9
Simplified10.9
rmApplied div-sub10.9
Applied div-sub10.9
if 9.354082991670835e-125 < b Initial program 49.8
Simplified49.8
rmApplied *-un-lft-identity49.8
Applied div-inv49.8
Applied times-frac49.8
Simplified49.8
Taylor expanded around inf 11.9
Simplified11.9
Final simplification10.3
herbie shell --seed 2019153
(FPCore (a b c)
:name "The quadratic formula (r1)"
: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)))