Average Error: 52.3 → 0.4
Time: 6.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{1}{\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)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{\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)}
double f(double a, double b, double c) {
        double r31253 = b;
        double r31254 = -r31253;
        double r31255 = r31253 * r31253;
        double r31256 = 4.0;
        double r31257 = a;
        double r31258 = r31256 * r31257;
        double r31259 = c;
        double r31260 = r31258 * r31259;
        double r31261 = r31255 - r31260;
        double r31262 = sqrt(r31261);
        double r31263 = r31254 + r31262;
        double r31264 = 2.0;
        double r31265 = r31264 * r31257;
        double r31266 = r31263 / r31265;
        return r31266;
}

double f(double a, double b, double c) {
        double r31267 = 1.0;
        double r31268 = 2.0;
        double r31269 = a;
        double r31270 = r31268 * r31269;
        double r31271 = 4.0;
        double r31272 = c;
        double r31273 = r31269 * r31272;
        double r31274 = r31271 * r31273;
        double r31275 = r31270 / r31274;
        double r31276 = b;
        double r31277 = -r31276;
        double r31278 = r31276 * r31276;
        double r31279 = r31271 * r31269;
        double r31280 = r31279 * r31272;
        double r31281 = r31278 - r31280;
        double r31282 = sqrt(r31281);
        double r31283 = r31277 - r31282;
        double r31284 = r31275 * r31283;
        double r31285 = r31267 / r31284;
        return r31285;
}

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

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

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

    \[\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. Final simplification0.4

    \[\leadsto \frac{1}{\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)}\]

Reproduce

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