Average Error: 28.6 → 0.5
Time: 7.5s
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{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{\frac{1}{2}}\right)}}{2 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{\frac{1}{2}}\right)}}{2 \cdot a}
double f(double a, double b, double c) {
        double r38869 = b;
        double r38870 = -r38869;
        double r38871 = r38869 * r38869;
        double r38872 = 4.0;
        double r38873 = a;
        double r38874 = r38872 * r38873;
        double r38875 = c;
        double r38876 = r38874 * r38875;
        double r38877 = r38871 - r38876;
        double r38878 = sqrt(r38877);
        double r38879 = r38870 + r38878;
        double r38880 = 2.0;
        double r38881 = r38880 * r38873;
        double r38882 = r38879 / r38881;
        return r38882;
}

double f(double a, double b, double c) {
        double r38883 = 0.0;
        double r38884 = 4.0;
        double r38885 = a;
        double r38886 = c;
        double r38887 = r38885 * r38886;
        double r38888 = r38884 * r38887;
        double r38889 = r38883 + r38888;
        double r38890 = b;
        double r38891 = sqrt(r38890);
        double r38892 = -r38891;
        double r38893 = r38890 * r38890;
        double r38894 = r38884 * r38885;
        double r38895 = r38894 * r38886;
        double r38896 = r38893 - r38895;
        double r38897 = 0.5;
        double r38898 = pow(r38896, r38897);
        double r38899 = -r38898;
        double r38900 = fma(r38892, r38891, r38899);
        double r38901 = r38889 / r38900;
        double r38902 = 2.0;
        double r38903 = r38902 * r38885;
        double r38904 = r38901 / r38903;
        return r38904;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.6

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

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

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{\sqrt[3]{\color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{3}}}}}}{2 \cdot a}\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt0.5

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\left(-\sqrt{b}\right) \cdot \sqrt{b}} - \sqrt{\sqrt[3]{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{3}}}}}{2 \cdot a}\]
  11. Applied fma-neg0.5

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

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

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

Reproduce

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