Average Error: 43.7 → 0.3
Time: 7.3s
Precision: 64
\[1.11022 \cdot 10^{-16} \lt a \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt b \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt c \lt 9.0072 \cdot 10^{15}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{\frac{\left(4 \cdot a\right) \cdot c}{2}}{a}}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{\frac{\left(4 \cdot a\right) \cdot c}{2}}{a}}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}
double f(double a, double b, double c) {
        double r36407 = b;
        double r36408 = -r36407;
        double r36409 = r36407 * r36407;
        double r36410 = 4.0;
        double r36411 = a;
        double r36412 = r36410 * r36411;
        double r36413 = c;
        double r36414 = r36412 * r36413;
        double r36415 = r36409 - r36414;
        double r36416 = sqrt(r36415);
        double r36417 = r36408 + r36416;
        double r36418 = 2.0;
        double r36419 = r36418 * r36411;
        double r36420 = r36417 / r36419;
        return r36420;
}

double f(double a, double b, double c) {
        double r36421 = 4.0;
        double r36422 = a;
        double r36423 = r36421 * r36422;
        double r36424 = c;
        double r36425 = r36423 * r36424;
        double r36426 = 2.0;
        double r36427 = r36425 / r36426;
        double r36428 = r36427 / r36422;
        double r36429 = b;
        double r36430 = -r36429;
        double r36431 = 6.0;
        double r36432 = pow(r36429, r36431);
        double r36433 = 3.0;
        double r36434 = pow(r36425, r36433);
        double r36435 = r36432 - r36434;
        double r36436 = r36422 * r36424;
        double r36437 = fma(r36429, r36429, r36425);
        double r36438 = r36436 * r36437;
        double r36439 = 4.0;
        double r36440 = pow(r36429, r36439);
        double r36441 = fma(r36421, r36438, r36440);
        double r36442 = r36435 / r36441;
        double r36443 = sqrt(r36442);
        double r36444 = r36430 - r36443;
        double r36445 = r36428 / r36444;
        return r36445;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 43.7

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Using strategy rm
  3. Applied flip-+43.7

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \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}\]
  4. Simplified0.4

    \[\leadsto \frac{\frac{\color{blue}{0 + 4 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied flip3--0.4

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{\frac{{\left(b \cdot b\right)}^{3} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\left(b \cdot b\right) \cdot \left(b \cdot b\right) + \left(\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right) + \left(b \cdot b\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)\right)}}}}}{2 \cdot a}\]
  7. Simplified0.4

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{\frac{\color{blue}{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}}{\left(b \cdot b\right) \cdot \left(b \cdot b\right) + \left(\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right) + \left(b \cdot b\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)\right)}}}}{2 \cdot a}\]
  8. Simplified0.4

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\color{blue}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}}}{2 \cdot a}\]
  9. Using strategy rm
  10. Applied div-inv0.5

    \[\leadsto \frac{\color{blue}{\left(0 + 4 \cdot \left(a \cdot c\right)\right) \cdot \frac{1}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}}}{2 \cdot a}\]
  11. Applied associate-/l*0.5

    \[\leadsto \color{blue}{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\frac{2 \cdot a}{\frac{1}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}}}}\]
  12. Simplified0.4

    \[\leadsto \frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}\right)}}\]
  13. Using strategy rm
  14. Applied associate-/r*0.3

    \[\leadsto \color{blue}{\frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{2 \cdot a}}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}}\]
  15. Simplified0.3

    \[\leadsto \frac{\color{blue}{\frac{\frac{\left(4 \cdot a\right) \cdot c}{2}}{a}}}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}\]
  16. Final simplification0.3

    \[\leadsto \frac{\frac{\frac{\left(4 \cdot a\right) \cdot c}{2}}{a}}{\left(-b\right) - \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4, \left(a \cdot c\right) \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}}\]

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))