Average Error: 28.4 → 0.5
Time: 6.1s
Precision: 64
\[1.05367121277235087 \cdot 10^{-8} \lt a \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt b \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt c \lt 94906265.6242515594\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{1}{2} \cdot \frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \sqrt{\frac{{\left(b \cdot b\right)}^{3} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4 \cdot a, c \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}\right)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{2} \cdot \frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \sqrt{\frac{{\left(b \cdot b\right)}^{3} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(4 \cdot a, c \cdot \mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right), {b}^{4}\right)}}\right)}
double f(double a, double b, double c) {
        double r35419 = b;
        double r35420 = -r35419;
        double r35421 = r35419 * r35419;
        double r35422 = 4.0;
        double r35423 = a;
        double r35424 = r35422 * r35423;
        double r35425 = c;
        double r35426 = r35424 * r35425;
        double r35427 = r35421 - r35426;
        double r35428 = sqrt(r35427);
        double r35429 = r35420 + r35428;
        double r35430 = 2.0;
        double r35431 = r35430 * r35423;
        double r35432 = r35429 / r35431;
        return r35432;
}

double f(double a, double b, double c) {
        double r35433 = 1.0;
        double r35434 = 2.0;
        double r35435 = r35433 / r35434;
        double r35436 = 4.0;
        double r35437 = a;
        double r35438 = c;
        double r35439 = r35437 * r35438;
        double r35440 = r35436 * r35439;
        double r35441 = b;
        double r35442 = -r35441;
        double r35443 = r35441 * r35441;
        double r35444 = 3.0;
        double r35445 = pow(r35443, r35444);
        double r35446 = r35436 * r35437;
        double r35447 = r35446 * r35438;
        double r35448 = pow(r35447, r35444);
        double r35449 = r35445 - r35448;
        double r35450 = fma(r35441, r35441, r35447);
        double r35451 = r35438 * r35450;
        double r35452 = 4.0;
        double r35453 = pow(r35441, r35452);
        double r35454 = fma(r35446, r35451, r35453);
        double r35455 = r35449 / r35454;
        double r35456 = sqrt(r35455);
        double r35457 = r35442 - r35456;
        double r35458 = r35437 * r35457;
        double r35459 = r35440 / r35458;
        double r35460 = r35435 * r35459;
        return r35460;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.4

    \[\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-+28.4

    \[\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.5

    \[\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 *-un-lft-identity0.5

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  7. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + 4 \cdot \left(a \cdot c\right)\right)}}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a}\]
  8. Applied times-frac0.5

    \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{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}\]
  9. Applied times-frac0.5

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

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  12. Using strategy rm
  13. Applied flip3--0.5

    \[\leadsto \frac{1}{2} \cdot \frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\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)}}}\right)}\]
  14. Simplified0.5

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

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

Reproduce

herbie shell --seed 2020018 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))