Average Error: 52.5 → 0.4
Time: 13.0s
Precision: 64
\[4.93038 \cdot 10^{-32} \lt a \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt b \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt c \lt 2.02824 \cdot 10^{31}\]
\[\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) + b \cdot \left(b - b\right)}{\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{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}{\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 r43969 = b;
        double r43970 = -r43969;
        double r43971 = r43969 * r43969;
        double r43972 = 4.0;
        double r43973 = a;
        double r43974 = r43972 * r43973;
        double r43975 = c;
        double r43976 = r43974 * r43975;
        double r43977 = r43971 - r43976;
        double r43978 = sqrt(r43977);
        double r43979 = r43970 + r43978;
        double r43980 = 2.0;
        double r43981 = r43980 * r43973;
        double r43982 = r43979 / r43981;
        return r43982;
}

double f(double a, double b, double c) {
        double r43983 = 4.0;
        double r43984 = a;
        double r43985 = c;
        double r43986 = r43984 * r43985;
        double r43987 = r43983 * r43986;
        double r43988 = b;
        double r43989 = r43988 - r43988;
        double r43990 = r43988 * r43989;
        double r43991 = r43987 + r43990;
        double r43992 = -r43988;
        double r43993 = r43988 * r43988;
        double r43994 = r43983 * r43984;
        double r43995 = r43994 * r43985;
        double r43996 = r43993 - r43995;
        double r43997 = sqrt(r43996);
        double r43998 = r43992 - r43997;
        double r43999 = r43991 / r43998;
        double r44000 = 2.0;
        double r44001 = r44000 * r43984;
        double r44002 = r43999 / r44001;
        return r44002;
}

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

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

    \[\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}{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Final simplification0.4

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

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (< 4.9303800000000003e-32 a 2.02824e+31) (< 4.9303800000000003e-32 b 2.02824e+31) (< 4.9303800000000003e-32 c 2.02824e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))