Average Error: 43.5 → 0.5
Time: 7.1s
Precision: 64
\[1.11022 \cdot 10^{-16} \lt a \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt b \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt c \lt 9.0072 \cdot 10^{15}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{1}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \cdot \left(4 \cdot \left(a \cdot c\right)\right)\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \cdot \left(4 \cdot \left(a \cdot c\right)\right)
double f(double a, double b, double c) {
        double r32014 = b;
        double r32015 = -r32014;
        double r32016 = r32014 * r32014;
        double r32017 = 4.0;
        double r32018 = a;
        double r32019 = r32017 * r32018;
        double r32020 = c;
        double r32021 = r32019 * r32020;
        double r32022 = r32016 - r32021;
        double r32023 = sqrt(r32022);
        double r32024 = r32015 + r32023;
        double r32025 = 2.0;
        double r32026 = r32025 * r32018;
        double r32027 = r32024 / r32026;
        return r32027;
}

double f(double a, double b, double c) {
        double r32028 = 1.0;
        double r32029 = 2.0;
        double r32030 = a;
        double r32031 = r32029 * r32030;
        double r32032 = b;
        double r32033 = -r32032;
        double r32034 = r32032 * r32032;
        double r32035 = 4.0;
        double r32036 = r32035 * r32030;
        double r32037 = c;
        double r32038 = r32036 * r32037;
        double r32039 = r32034 - r32038;
        double r32040 = sqrt(r32039);
        double r32041 = r32033 - r32040;
        double r32042 = r32031 * r32041;
        double r32043 = r32028 / r32042;
        double r32044 = r32030 * r32037;
        double r32045 = r32035 * r32044;
        double r32046 = r32043 * r32045;
        return r32046;
}

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.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-+43.6

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

    \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}}\]
  7. Simplified0.5

    \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot a}{4 \cdot \left(a \cdot c\right)} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  8. Using strategy rm
  9. Applied associate-*l/0.5

    \[\leadsto \frac{1}{\color{blue}{\frac{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}{4 \cdot \left(a \cdot c\right)}}}\]
  10. Applied associate-/r/0.5

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

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

Reproduce

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