Average Error: 52.6 → 6.1
Time: 18.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{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 r711578 = b;
        double r711579 = -r711578;
        double r711580 = r711578 * r711578;
        double r711581 = 4.0;
        double r711582 = a;
        double r711583 = r711581 * r711582;
        double r711584 = c;
        double r711585 = r711583 * r711584;
        double r711586 = r711580 - r711585;
        double r711587 = sqrt(r711586);
        double r711588 = r711579 + r711587;
        double r711589 = 2.0;
        double r711590 = r711589 * r711582;
        double r711591 = r711588 / r711590;
        return r711591;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r711592 = c;
        double r711593 = b;
        double r711594 = r711592 / r711593;
        double r711595 = -2.0;
        double r711596 = r711594 * r711595;
        double r711597 = 2.0;
        double r711598 = r711596 / r711597;
        return r711598;
}

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

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

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

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

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

Reproduce

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