Average Error: 52.6 → 0.4
Time: 21.8s
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(a \cdot c\right) \cdot 4}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot \left(-4\right), {b}^{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{\left(a \cdot c\right) \cdot 4}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot \left(-4\right), {b}^{2}\right)}}}{2 \cdot a}
double f(double a, double b, double c) {
        double r36144 = b;
        double r36145 = -r36144;
        double r36146 = r36144 * r36144;
        double r36147 = 4.0;
        double r36148 = a;
        double r36149 = r36147 * r36148;
        double r36150 = c;
        double r36151 = r36149 * r36150;
        double r36152 = r36146 - r36151;
        double r36153 = sqrt(r36152);
        double r36154 = r36145 + r36153;
        double r36155 = 2.0;
        double r36156 = r36155 * r36148;
        double r36157 = r36154 / r36156;
        return r36157;
}

double f(double a, double b, double c) {
        double r36158 = a;
        double r36159 = c;
        double r36160 = r36158 * r36159;
        double r36161 = 4.0;
        double r36162 = r36160 * r36161;
        double r36163 = b;
        double r36164 = -r36163;
        double r36165 = -r36161;
        double r36166 = r36158 * r36165;
        double r36167 = 2.0;
        double r36168 = pow(r36163, r36167);
        double r36169 = fma(r36159, r36166, r36168);
        double r36170 = sqrt(r36169);
        double r36171 = r36164 - r36170;
        double r36172 = r36162 / r36171;
        double r36173 = 2.0;
        double r36174 = r36173 * r36158;
        double r36175 = r36172 / r36174;
        return r36175;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.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-+52.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 + \left(c \cdot a\right) \cdot 4}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Simplified0.4

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

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

Reproduce

herbie shell --seed 2019196 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))