Average Error: 52.3 → 0.4
Time: 6.3s
Precision: 64
\[4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt a \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt b \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt c \lt 20282409603651670423947251286016\]
\[\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 r36442 = b;
        double r36443 = -r36442;
        double r36444 = r36442 * r36442;
        double r36445 = 4.0;
        double r36446 = a;
        double r36447 = r36445 * r36446;
        double r36448 = c;
        double r36449 = r36447 * r36448;
        double r36450 = r36444 - r36449;
        double r36451 = sqrt(r36450);
        double r36452 = r36443 + r36451;
        double r36453 = 2.0;
        double r36454 = r36453 * r36446;
        double r36455 = r36452 / r36454;
        return r36455;
}

double f(double a, double b, double c) {
        double r36456 = 0.0;
        double r36457 = 4.0;
        double r36458 = a;
        double r36459 = c;
        double r36460 = r36458 * r36459;
        double r36461 = r36457 * r36460;
        double r36462 = r36456 + r36461;
        double r36463 = 2.0;
        double r36464 = r36463 * r36458;
        double r36465 = b;
        double r36466 = -r36465;
        double r36467 = r36464 * r36466;
        double r36468 = r36465 * r36465;
        double r36469 = r36457 * r36458;
        double r36470 = r36469 * r36459;
        double r36471 = r36468 - r36470;
        double r36472 = sqrt(r36471);
        double r36473 = -r36472;
        double r36474 = r36464 * r36473;
        double r36475 = r36467 + r36474;
        double r36476 = r36462 / r36475;
        return r36476;
}

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 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, 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)))