Average Error: 44.0 → 0.4
Time: 6.3s
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{0 + 4 \cdot \left(a \cdot c\right)}{\left(2 \cdot a\right) \cdot \left(-b\right) + \left(2 \cdot a\right) \cdot \left(-\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{0 + 4 \cdot \left(a \cdot c\right)}{\left(2 \cdot a\right) \cdot \left(-b\right) + \left(2 \cdot a\right) \cdot \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}
double f(double a, double b, double c) {
        double r39938 = b;
        double r39939 = -r39938;
        double r39940 = r39938 * r39938;
        double r39941 = 4.0;
        double r39942 = a;
        double r39943 = r39941 * r39942;
        double r39944 = c;
        double r39945 = r39943 * r39944;
        double r39946 = r39940 - r39945;
        double r39947 = sqrt(r39946);
        double r39948 = r39939 + r39947;
        double r39949 = 2.0;
        double r39950 = r39949 * r39942;
        double r39951 = r39948 / r39950;
        return r39951;
}

double f(double a, double b, double c) {
        double r39952 = 0.0;
        double r39953 = 4.0;
        double r39954 = a;
        double r39955 = c;
        double r39956 = r39954 * r39955;
        double r39957 = r39953 * r39956;
        double r39958 = r39952 + r39957;
        double r39959 = 2.0;
        double r39960 = r39959 * r39954;
        double r39961 = b;
        double r39962 = -r39961;
        double r39963 = r39960 * r39962;
        double r39964 = r39961 * r39961;
        double r39965 = r39953 * r39954;
        double r39966 = r39965 * r39955;
        double r39967 = r39964 - r39966;
        double r39968 = sqrt(r39967);
        double r39969 = -r39968;
        double r39970 = r39960 * r39969;
        double r39971 = r39963 + r39970;
        double r39972 = r39958 / r39971;
        return r39972;
}

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

    \[\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 sub-neg0.4

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

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

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

Reproduce

herbie shell --seed 2019354 +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)))