Average Error: 52.3 → 6.3
Time: 18.3s
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{c}{b} \cdot -2}{2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{c}{b} \cdot -2}{2}
double f(double a, double b, double c) {
        double r695726 = b;
        double r695727 = -r695726;
        double r695728 = r695726 * r695726;
        double r695729 = 4.0;
        double r695730 = a;
        double r695731 = r695729 * r695730;
        double r695732 = c;
        double r695733 = r695731 * r695732;
        double r695734 = r695728 - r695733;
        double r695735 = sqrt(r695734);
        double r695736 = r695727 + r695735;
        double r695737 = 2.0;
        double r695738 = r695737 * r695730;
        double r695739 = r695736 / r695738;
        return r695739;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r695740 = c;
        double r695741 = b;
        double r695742 = r695740 / r695741;
        double r695743 = -2.0;
        double r695744 = r695742 * r695743;
        double r695745 = 2.0;
        double r695746 = r695744 / r695745;
        return r695746;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 52.3

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

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a} - b}{a}}{2}}\]
  3. Taylor expanded around inf 6.3

    \[\leadsto \frac{\color{blue}{-2 \cdot \frac{c}{b}}}{2}\]
  4. Final simplification6.3

    \[\leadsto \frac{\frac{c}{b} \cdot -2}{2}\]

Reproduce

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