\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le -0.23006184402457236:\\
\;\;\;\;\frac{\frac{b \cdot b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\
\mathbf{elif}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le -7.174313107484387 \cdot 10^{-05}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\log \left(\frac{c \cdot a}{b}\right)}\right)\right) \cdot -2}{2 \cdot a}\\
\mathbf{elif}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le -7.611140755287658 \cdot 10^{-08}:\\
\;\;\;\;\sqrt[3]{\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)} - b}{2 \cdot a} \cdot \left(\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)} - b}{2 \cdot a} \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)} - b}{2 \cdot a}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}double f(double a, double b, double c) {
double r2119372 = b;
double r2119373 = -r2119372;
double r2119374 = r2119372 * r2119372;
double r2119375 = 4.0;
double r2119376 = a;
double r2119377 = r2119375 * r2119376;
double r2119378 = c;
double r2119379 = r2119377 * r2119378;
double r2119380 = r2119374 - r2119379;
double r2119381 = sqrt(r2119380);
double r2119382 = r2119373 + r2119381;
double r2119383 = 2.0;
double r2119384 = r2119383 * r2119376;
double r2119385 = r2119382 / r2119384;
return r2119385;
}
double f(double a, double b, double c) {
double r2119386 = b;
double r2119387 = r2119386 * r2119386;
double r2119388 = 4.0;
double r2119389 = a;
double r2119390 = r2119388 * r2119389;
double r2119391 = c;
double r2119392 = r2119390 * r2119391;
double r2119393 = r2119387 - r2119392;
double r2119394 = sqrt(r2119393);
double r2119395 = -r2119386;
double r2119396 = r2119394 + r2119395;
double r2119397 = 2.0;
double r2119398 = r2119397 * r2119389;
double r2119399 = r2119396 / r2119398;
double r2119400 = -0.23006184402457236;
bool r2119401 = r2119399 <= r2119400;
double r2119402 = r2119394 * r2119394;
double r2119403 = r2119387 - r2119402;
double r2119404 = r2119395 - r2119394;
double r2119405 = r2119403 / r2119404;
double r2119406 = r2119405 / r2119398;
double r2119407 = -7.174313107484387e-05;
bool r2119408 = r2119399 <= r2119407;
double r2119409 = r2119391 * r2119389;
double r2119410 = r2119409 / r2119386;
double r2119411 = log(r2119410);
double r2119412 = exp(r2119411);
double r2119413 = log1p(r2119412);
double r2119414 = expm1(r2119413);
double r2119415 = -2.0;
double r2119416 = r2119414 * r2119415;
double r2119417 = r2119416 / r2119398;
double r2119418 = -7.611140755287658e-08;
bool r2119419 = r2119399 <= r2119418;
double r2119420 = -4.0;
double r2119421 = r2119420 * r2119389;
double r2119422 = r2119421 * r2119391;
double r2119423 = fma(r2119386, r2119386, r2119422);
double r2119424 = sqrt(r2119423);
double r2119425 = r2119424 - r2119386;
double r2119426 = r2119425 / r2119398;
double r2119427 = r2119426 * r2119426;
double r2119428 = r2119426 * r2119427;
double r2119429 = cbrt(r2119428);
double r2119430 = -r2119391;
double r2119431 = r2119430 / r2119386;
double r2119432 = r2119419 ? r2119429 : r2119431;
double r2119433 = r2119408 ? r2119417 : r2119432;
double r2119434 = r2119401 ? r2119406 : r2119433;
return r2119434;
}



Bits error versus a



Bits error versus b



Bits error versus c
if (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) < -0.23006184402457236Initial program 20.3
rmApplied flip-+20.3
if -0.23006184402457236 < (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) < -7.174313107484387e-05Initial program 23.6
Taylor expanded around inf 25.7
rmApplied expm1-log1p-u25.7
rmApplied add-exp-log25.7
if -7.174313107484387e-05 < (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) < -7.611140755287658e-08Initial program 25.4
rmApplied add-cbrt-cube25.4
Applied add-cbrt-cube25.4
Applied cbrt-unprod25.4
Applied add-cbrt-cube25.4
Applied cbrt-undiv25.4
Simplified25.4
if -7.611140755287658e-08 < (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) Initial program 54.3
Taylor expanded around inf 4.6
Simplified4.6
Final simplification10.3
herbie shell --seed 2019151 +o rules:numerics
(FPCore (a b c)
:name "Quadratic roots, medium range"
:pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))