\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 -4.1515494582665793 \cdot 10^{-119}:\\
\;\;\;\;1 \cdot \left(-1 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \le 4.2504918589151378 \cdot 10^{117}:\\
\;\;\;\;1 \cdot \frac{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\right)\\
\end{array}double f(double a, double b, double c) {
double r91460 = b;
double r91461 = -r91460;
double r91462 = r91460 * r91460;
double r91463 = 4.0;
double r91464 = a;
double r91465 = c;
double r91466 = r91464 * r91465;
double r91467 = r91463 * r91466;
double r91468 = r91462 - r91467;
double r91469 = sqrt(r91468);
double r91470 = r91461 - r91469;
double r91471 = 2.0;
double r91472 = r91471 * r91464;
double r91473 = r91470 / r91472;
return r91473;
}
double f(double a, double b, double c) {
double r91474 = b;
double r91475 = -4.1515494582665793e-119;
bool r91476 = r91474 <= r91475;
double r91477 = 1.0;
double r91478 = -1.0;
double r91479 = c;
double r91480 = r91479 / r91474;
double r91481 = r91478 * r91480;
double r91482 = r91477 * r91481;
double r91483 = 4.250491858915138e+117;
bool r91484 = r91474 <= r91483;
double r91485 = -r91474;
double r91486 = 4.0;
double r91487 = a;
double r91488 = r91487 * r91479;
double r91489 = r91486 * r91488;
double r91490 = -r91489;
double r91491 = fma(r91474, r91474, r91490);
double r91492 = sqrt(r91491);
double r91493 = r91485 - r91492;
double r91494 = 2.0;
double r91495 = r91494 * r91487;
double r91496 = r91493 / r91495;
double r91497 = r91477 * r91496;
double r91498 = 1.0;
double r91499 = r91474 / r91487;
double r91500 = r91480 - r91499;
double r91501 = r91498 * r91500;
double r91502 = r91477 * r91501;
double r91503 = r91484 ? r91497 : r91502;
double r91504 = r91476 ? r91482 : r91503;
return r91504;
}




Bits error versus a




Bits error versus b




Bits error versus c
| Original | 34.4 |
|---|---|
| Target | 21.3 |
| Herbie | 10.4 |
if b < -4.1515494582665793e-119Initial program 51.5
rmApplied div-inv51.5
rmApplied *-un-lft-identity51.5
Applied associate-*l*51.5
Simplified51.5
Taylor expanded around -inf 11.4
if -4.1515494582665793e-119 < b < 4.250491858915138e+117Initial program 11.8
rmApplied div-inv11.9
rmApplied *-un-lft-identity11.9
Applied associate-*l*11.9
Simplified11.8
rmApplied fma-neg11.8
if 4.250491858915138e+117 < b Initial program 52.2
rmApplied div-inv52.3
rmApplied *-un-lft-identity52.3
Applied associate-*l*52.3
Simplified52.2
Taylor expanded around inf 2.9
Simplified2.9
Final simplification10.4
herbie shell --seed 2020081 +o rules:numerics
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
:herbie-target
(if (< b 0.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)))