Average Error: 44.0 → 0.4
Time: 18.6s
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{c \cdot \left(4 \cdot a\right)}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{c \cdot \left(4 \cdot a\right)}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}
double f(double a, double b, double c) {
        double r40909 = b;
        double r40910 = -r40909;
        double r40911 = r40909 * r40909;
        double r40912 = 4.0;
        double r40913 = a;
        double r40914 = r40912 * r40913;
        double r40915 = c;
        double r40916 = r40914 * r40915;
        double r40917 = r40911 - r40916;
        double r40918 = sqrt(r40917);
        double r40919 = r40910 + r40918;
        double r40920 = 2.0;
        double r40921 = r40920 * r40913;
        double r40922 = r40919 / r40921;
        return r40922;
}

double f(double a, double b, double c) {
        double r40923 = c;
        double r40924 = 4.0;
        double r40925 = a;
        double r40926 = r40924 * r40925;
        double r40927 = r40923 * r40926;
        double r40928 = 2.0;
        double r40929 = r40928 * r40925;
        double r40930 = b;
        double r40931 = -r40930;
        double r40932 = r40930 * r40930;
        double r40933 = r40926 * r40923;
        double r40934 = r40932 - r40933;
        double r40935 = sqrt(r40934);
        double r40936 = r40931 - r40935;
        double r40937 = r40929 * r40936;
        double r40938 = r40927 / r40937;
        return r40938;
}

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 44.0

    \[\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-+44.0

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

    \[\leadsto \frac{\color{blue}{\left(0 + \left(4 \cdot a\right) \cdot c\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 + \left(4 \cdot a\right) \cdot c}{\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 + \left(4 \cdot a\right) \cdot c}{\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. Final simplification0.4

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

Reproduce

herbie shell --seed 2019303 
(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)))