Average Error: 52.3 → 0.2
Time: 22.0s
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{4 \cdot \left(a \cdot c\right)}{2 \cdot a}}{\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{\frac{4 \cdot \left(a \cdot c\right)}{2 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}
double f(double a, double b, double c) {
        double r30700 = b;
        double r30701 = -r30700;
        double r30702 = r30700 * r30700;
        double r30703 = 4.0;
        double r30704 = a;
        double r30705 = r30703 * r30704;
        double r30706 = c;
        double r30707 = r30705 * r30706;
        double r30708 = r30702 - r30707;
        double r30709 = sqrt(r30708);
        double r30710 = r30701 + r30709;
        double r30711 = 2.0;
        double r30712 = r30711 * r30704;
        double r30713 = r30710 / r30712;
        return r30713;
}

double f(double a, double b, double c) {
        double r30714 = 4.0;
        double r30715 = a;
        double r30716 = c;
        double r30717 = r30715 * r30716;
        double r30718 = r30714 * r30717;
        double r30719 = 2.0;
        double r30720 = r30719 * r30715;
        double r30721 = r30718 / r30720;
        double r30722 = b;
        double r30723 = -r30722;
        double r30724 = r30722 * r30722;
        double r30725 = r30714 * r30715;
        double r30726 = r30725 * r30716;
        double r30727 = r30724 - r30726;
        double r30728 = sqrt(r30727);
        double r30729 = r30723 - r30728;
        double r30730 = r30721 / r30729;
        return r30730;
}

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. Using strategy rm
  3. Applied flip-+52.3

    \[\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(a \cdot c\right) \cdot 4}}{\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(a \cdot c\right) \cdot 4}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \frac{1}{2 \cdot a}}\]
  7. Using strategy rm
  8. Applied associate-*l/0.3

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

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

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

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(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)))