Average Error: 43.8 → 0.4
Time: 12.0s
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{4 \cdot \left(a \cdot c\right)}{\left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{4 \cdot \left(a \cdot c\right)}{\left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}
double f(double a, double b, double c) {
        double r37017 = b;
        double r37018 = -r37017;
        double r37019 = r37017 * r37017;
        double r37020 = 4.0;
        double r37021 = a;
        double r37022 = r37020 * r37021;
        double r37023 = c;
        double r37024 = r37022 * r37023;
        double r37025 = r37019 - r37024;
        double r37026 = sqrt(r37025);
        double r37027 = r37018 + r37026;
        double r37028 = 2.0;
        double r37029 = r37028 * r37021;
        double r37030 = r37027 / r37029;
        return r37030;
}

double f(double a, double b, double c) {
        double r37031 = 4.0;
        double r37032 = a;
        double r37033 = c;
        double r37034 = r37032 * r37033;
        double r37035 = r37031 * r37034;
        double r37036 = b;
        double r37037 = -r37036;
        double r37038 = r37036 * r37036;
        double r37039 = r37031 * r37032;
        double r37040 = r37039 * r37033;
        double r37041 = r37038 - r37040;
        double r37042 = sqrt(r37041);
        double r37043 = r37037 - r37042;
        double r37044 = r37032 * r37043;
        double r37045 = 2.0;
        double r37046 = r37044 * r37045;
        double r37047 = r37035 / r37046;
        return r37047;
}

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

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

    \[\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. Using strategy rm
  6. Applied div-inv0.5

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

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

Reproduce

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