Average Error: 43.7 → 0.2
Time: 6.7s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{\frac{4 \cdot \left(a \cdot c\right)}{2}}{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{\frac{4 \cdot \left(a \cdot c\right)}{2}}{a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}
double f(double a, double b, double c) {
        double r38553 = b;
        double r38554 = -r38553;
        double r38555 = r38553 * r38553;
        double r38556 = 4.0;
        double r38557 = a;
        double r38558 = r38556 * r38557;
        double r38559 = c;
        double r38560 = r38558 * r38559;
        double r38561 = r38555 - r38560;
        double r38562 = sqrt(r38561);
        double r38563 = r38554 + r38562;
        double r38564 = 2.0;
        double r38565 = r38564 * r38557;
        double r38566 = r38563 / r38565;
        return r38566;
}

double f(double a, double b, double c) {
        double r38567 = 4.0;
        double r38568 = a;
        double r38569 = c;
        double r38570 = r38568 * r38569;
        double r38571 = r38567 * r38570;
        double r38572 = 2.0;
        double r38573 = r38571 / r38572;
        double r38574 = r38573 / r38568;
        double r38575 = b;
        double r38576 = -r38575;
        double r38577 = r38575 * r38575;
        double r38578 = r38567 * r38568;
        double r38579 = r38578 * r38569;
        double r38580 = r38577 - r38579;
        double r38581 = sqrt(r38580);
        double r38582 = r38576 - r38581;
        double r38583 = r38574 / r38582;
        return r38583;
}

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 43.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-+43.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 + 4 \cdot \left(a \cdot c\right)}}{\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.5

    \[\leadsto \frac{\color{blue}{\left(0 + 4 \cdot \left(a \cdot c\right)\right) \cdot \frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  7. Applied associate-/l*0.5

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

    \[\leadsto \frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  9. Using strategy rm
  10. Applied associate-/r*0.2

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

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

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

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))