Average Error: 43.9 → 0.4
Time: 26.5s
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{\left(a \cdot c\right) \cdot 4}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{\left(a \cdot c\right) \cdot 4}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}
double f(double a, double b, double c) {
        double r65667 = b;
        double r65668 = -r65667;
        double r65669 = r65667 * r65667;
        double r65670 = 4.0;
        double r65671 = a;
        double r65672 = r65670 * r65671;
        double r65673 = c;
        double r65674 = r65672 * r65673;
        double r65675 = r65669 - r65674;
        double r65676 = sqrt(r65675);
        double r65677 = r65668 + r65676;
        double r65678 = 2.0;
        double r65679 = r65678 * r65671;
        double r65680 = r65677 / r65679;
        return r65680;
}

double f(double a, double b, double c) {
        double r65681 = a;
        double r65682 = c;
        double r65683 = r65681 * r65682;
        double r65684 = 4.0;
        double r65685 = r65683 * r65684;
        double r65686 = b;
        double r65687 = -r65686;
        double r65688 = r65686 * r65686;
        double r65689 = r65684 * r65681;
        double r65690 = r65689 * r65682;
        double r65691 = r65688 - r65690;
        double r65692 = sqrt(r65691);
        double r65693 = r65687 - r65692;
        double r65694 = r65685 / r65693;
        double r65695 = 2.0;
        double r65696 = r65695 * r65681;
        double r65697 = r65694 / r65696;
        return r65697;
}

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

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

    \[\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. Final simplification0.4

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

Reproduce

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