Average Error: 52.5 → 0.4
Time: 20.1s
Precision: 64
\[4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt a \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt b \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt c \lt 20282409603651670423947251286016\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{\frac{\frac{\mathsf{fma}\left(b, {b}^{3}, -\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)\right)}{\sqrt{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}{\sqrt{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}}}{2 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{\frac{\frac{\mathsf{fma}\left(b, {b}^{3}, -\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)\right)}{\sqrt{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}{\sqrt{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}}}{2 \cdot a}
double f(double a, double b, double c) {
        double r36909 = b;
        double r36910 = -r36909;
        double r36911 = r36909 * r36909;
        double r36912 = 4.0;
        double r36913 = a;
        double r36914 = r36912 * r36913;
        double r36915 = c;
        double r36916 = r36914 * r36915;
        double r36917 = r36911 - r36916;
        double r36918 = sqrt(r36917);
        double r36919 = r36910 + r36918;
        double r36920 = 2.0;
        double r36921 = r36920 * r36913;
        double r36922 = r36919 / r36921;
        return r36922;
}

double f(double a, double b, double c) {
        double r36923 = 4.0;
        double r36924 = a;
        double r36925 = r36923 * r36924;
        double r36926 = c;
        double r36927 = r36925 * r36926;
        double r36928 = b;
        double r36929 = -r36928;
        double r36930 = 3.0;
        double r36931 = pow(r36928, r36930);
        double r36932 = r36927 * r36927;
        double r36933 = -r36932;
        double r36934 = fma(r36928, r36931, r36933);
        double r36935 = fma(r36928, r36928, r36927);
        double r36936 = sqrt(r36935);
        double r36937 = r36934 / r36936;
        double r36938 = r36937 / r36936;
        double r36939 = sqrt(r36938);
        double r36940 = r36929 - r36939;
        double r36941 = r36927 / r36940;
        double r36942 = 2.0;
        double r36943 = r36942 * r36924;
        double r36944 = r36941 / r36943;
        return r36944;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.5

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

    \[\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 + c \cdot \left(4 \cdot a\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied flip--0.4

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019208 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (< 4.93038e-32 a 2.02824e31) (< 4.93038e-32 b 2.02824e31) (< 4.93038e-32 c 2.02824e31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))