Average Error: 52.5 → 0.2
Time: 9.2s
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)}{2 \cdot a}}{-\left(b + \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{\frac{4 \cdot \left(a \cdot c\right)}{2 \cdot a}}{-\left(b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}
double f(double a, double b, double c) {
        double r36325 = b;
        double r36326 = -r36325;
        double r36327 = r36325 * r36325;
        double r36328 = 4.0;
        double r36329 = a;
        double r36330 = r36328 * r36329;
        double r36331 = c;
        double r36332 = r36330 * r36331;
        double r36333 = r36327 - r36332;
        double r36334 = sqrt(r36333);
        double r36335 = r36326 + r36334;
        double r36336 = 2.0;
        double r36337 = r36336 * r36329;
        double r36338 = r36335 / r36337;
        return r36338;
}

double f(double a, double b, double c) {
        double r36339 = 4.0;
        double r36340 = a;
        double r36341 = c;
        double r36342 = r36340 * r36341;
        double r36343 = r36339 * r36342;
        double r36344 = 2.0;
        double r36345 = r36344 * r36340;
        double r36346 = r36343 / r36345;
        double r36347 = b;
        double r36348 = r36347 * r36347;
        double r36349 = r36339 * r36340;
        double r36350 = r36349 * r36341;
        double r36351 = r36348 - r36350;
        double r36352 = sqrt(r36351);
        double r36353 = r36347 + r36352;
        double r36354 = -r36353;
        double r36355 = r36346 / r36354;
        return r36355;
}

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}{b \cdot \left(b - b\right) + 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.4

    \[\leadsto \frac{\color{blue}{\left(b \cdot \left(b - b\right) + 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{b \cdot \left(b - b\right) + 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{b \cdot \left(b - b\right) + 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{b \cdot \left(b - b\right) + 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{b \cdot \left(b - b\right) + 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. Simplified0.4

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

    \[\leadsto \frac{b \cdot \left(b - b\right) + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) \cdot \left(2 \cdot a\right) + \color{blue}{\left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \left(2 \cdot a\right)}}\]
  14. Using strategy rm
  15. Applied distribute-rgt-out0.4

    \[\leadsto \frac{b \cdot \left(b - b\right) + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) + \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}}\]
  16. Applied associate-/r*0.2

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

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

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

Reproduce

herbie shell --seed 2020043 
(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)))