Average Error: 28.4 → 0.5
Time: 5.9s
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(\mathsf{fma}\left(\sqrt{b}, -\sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\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(\mathsf{fma}\left(\sqrt{b}, -\sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\right)\right)}
double f(double a, double b, double c) {
        double r38430 = b;
        double r38431 = -r38430;
        double r38432 = r38430 * r38430;
        double r38433 = 4.0;
        double r38434 = a;
        double r38435 = r38433 * r38434;
        double r38436 = c;
        double r38437 = r38435 * r38436;
        double r38438 = r38432 - r38437;
        double r38439 = sqrt(r38438);
        double r38440 = r38431 + r38439;
        double r38441 = 2.0;
        double r38442 = r38441 * r38434;
        double r38443 = r38440 / r38442;
        return r38443;
}

double f(double a, double b, double c) {
        double r38444 = 1.0;
        double r38445 = 2.0;
        double r38446 = r38444 / r38445;
        double r38447 = 4.0;
        double r38448 = a;
        double r38449 = c;
        double r38450 = r38448 * r38449;
        double r38451 = r38447 * r38450;
        double r38452 = b;
        double r38453 = sqrt(r38452);
        double r38454 = -r38453;
        double r38455 = r38452 * r38452;
        double r38456 = r38447 * r38448;
        double r38457 = r38456 * r38449;
        double r38458 = r38455 - r38457;
        double r38459 = sqrt(r38458);
        double r38460 = sqrt(r38444);
        double r38461 = r38459 * r38460;
        double r38462 = -r38461;
        double r38463 = fma(r38453, r38454, r38462);
        double r38464 = -r38460;
        double r38465 = r38464 + r38460;
        double r38466 = r38459 * r38465;
        double r38467 = r38463 + r38466;
        double r38468 = r38448 * r38467;
        double r38469 = r38451 / r38468;
        double r38470 = r38446 * r38469;
        return r38470;
}

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

    \[\leadsto \frac{1}{2} \cdot \frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \sqrt{\color{blue}{1 \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}}\right)}\]
  14. Applied sqrt-prod0.5

    \[\leadsto \frac{1}{2} \cdot \frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \color{blue}{\sqrt{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}\]
  15. Applied add-sqr-sqrt0.5

    \[\leadsto \frac{1}{2} \cdot \frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-\color{blue}{\sqrt{b} \cdot \sqrt{b}}\right) - \sqrt{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}\]
  16. Applied distribute-lft-neg-in0.5

    \[\leadsto \frac{1}{2} \cdot \frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\color{blue}{\left(-\sqrt{b}\right) \cdot \sqrt{b}} - \sqrt{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}\]
  17. Applied prod-diff0.5

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

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

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

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

Reproduce

herbie shell --seed 2020064 +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)))