Average Error: 44.2 → 42.5
Time: 1.1m
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right)} \cdot {\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}\right), \left(-b\right)\right)}{2}}{a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right)} \cdot {\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}\right), \left(-b\right)\right)}{2}}{a}
double f(double a, double b, double c) {
        double r4999880 = b;
        double r4999881 = -r4999880;
        double r4999882 = r4999880 * r4999880;
        double r4999883 = 4.0;
        double r4999884 = a;
        double r4999885 = r4999883 * r4999884;
        double r4999886 = c;
        double r4999887 = r4999885 * r4999886;
        double r4999888 = r4999882 - r4999887;
        double r4999889 = sqrt(r4999888);
        double r4999890 = r4999881 + r4999889;
        double r4999891 = 2.0;
        double r4999892 = r4999891 * r4999884;
        double r4999893 = r4999890 / r4999892;
        return r4999893;
}

double f(double a, double b, double c) {
        double r4999894 = c;
        double r4999895 = a;
        double r4999896 = -4.0;
        double r4999897 = r4999895 * r4999896;
        double r4999898 = b;
        double r4999899 = r4999898 * r4999898;
        double r4999900 = fma(r4999894, r4999897, r4999899);
        double r4999901 = sqrt(r4999900);
        double r4999902 = sqrt(r4999901);
        double r4999903 = r4999894 * r4999896;
        double r4999904 = fma(r4999903, r4999895, r4999899);
        double r4999905 = r4999904 * r4999904;
        double r4999906 = cbrt(r4999905);
        double r4999907 = 0.3333333333333333;
        double r4999908 = pow(r4999900, r4999907);
        double r4999909 = r4999906 * r4999908;
        double r4999910 = sqrt(r4999909);
        double r4999911 = sqrt(r4999910);
        double r4999912 = -r4999898;
        double r4999913 = fma(r4999902, r4999911, r4999912);
        double r4999914 = 2.0;
        double r4999915 = r4999913 / r4999914;
        double r4999916 = r4999915 / r4999895;
        return r4999916;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 44.2

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Simplified44.1

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)} - b}{2}}{a}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt44.1

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

    \[\leadsto \frac{\frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{2}}{a}\]
  6. Applied fma-neg43.5

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}}{2}}{a}\]
  7. Using strategy rm
  8. Applied add-cbrt-cube43.6

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}}}\right), \left(-b\right)\right)}{2}}{a}\]
  9. Using strategy rm
  10. Applied pow1/343.2

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\color{blue}{{\left(\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}\right), \left(-b\right)\right)}{2}}{a}\]
  11. Using strategy rm
  12. Applied unpow-prod-down43.2

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

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

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

Reproduce

herbie shell --seed 2019124 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))