Average Error: 52.7 → 0.4
Time: 18.6s
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{1}{2 \cdot a} \cdot \frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{2 \cdot a} \cdot \frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}
double f(double a, double b, double c) {
        double r29595 = b;
        double r29596 = -r29595;
        double r29597 = r29595 * r29595;
        double r29598 = 4.0;
        double r29599 = a;
        double r29600 = r29598 * r29599;
        double r29601 = c;
        double r29602 = r29600 * r29601;
        double r29603 = r29597 - r29602;
        double r29604 = sqrt(r29603);
        double r29605 = r29596 + r29604;
        double r29606 = 2.0;
        double r29607 = r29606 * r29599;
        double r29608 = r29605 / r29607;
        return r29608;
}

double f(double a, double b, double c) {
        double r29609 = 1.0;
        double r29610 = 2.0;
        double r29611 = a;
        double r29612 = r29610 * r29611;
        double r29613 = r29609 / r29612;
        double r29614 = 4.0;
        double r29615 = r29614 * r29611;
        double r29616 = c;
        double r29617 = r29615 * r29616;
        double r29618 = b;
        double r29619 = -r29618;
        double r29620 = r29618 * r29618;
        double r29621 = r29620 - r29617;
        double r29622 = sqrt(r29621);
        double r29623 = r29619 - r29622;
        double r29624 = r29617 / r29623;
        double r29625 = r29613 * r29624;
        return r29625;
}

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

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

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

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

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

Reproduce

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