Average Error: 52.4 → 0.1
Time: 8.2s
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{1}{2} \cdot \left(\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot 4\right)\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{2} \cdot \left(\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot 4\right)
double f(double a, double b, double c) {
        double r38721 = b;
        double r38722 = -r38721;
        double r38723 = r38721 * r38721;
        double r38724 = 4.0;
        double r38725 = a;
        double r38726 = r38724 * r38725;
        double r38727 = c;
        double r38728 = r38726 * r38727;
        double r38729 = r38723 - r38728;
        double r38730 = sqrt(r38729);
        double r38731 = r38722 + r38730;
        double r38732 = 2.0;
        double r38733 = r38732 * r38725;
        double r38734 = r38731 / r38733;
        return r38734;
}

double f(double a, double b, double c) {
        double r38735 = 1.0;
        double r38736 = 2.0;
        double r38737 = r38735 / r38736;
        double r38738 = c;
        double r38739 = b;
        double r38740 = -r38739;
        double r38741 = r38739 * r38739;
        double r38742 = 4.0;
        double r38743 = a;
        double r38744 = r38742 * r38743;
        double r38745 = r38744 * r38738;
        double r38746 = r38741 - r38745;
        double r38747 = sqrt(r38746);
        double r38748 = r38740 - r38747;
        double r38749 = r38738 / r38748;
        double r38750 = r38749 * r38742;
        double r38751 = r38737 * r38750;
        return r38751;
}

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

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

    \[\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 *-un-lft-identity0.4

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  7. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + 4 \cdot \left(a \cdot c\right)\right)}}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a}\]
  8. Applied times-frac0.4

    \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{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}\]
  9. Applied times-frac0.4

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

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  12. Using strategy rm
  13. Applied clear-num0.4

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

    \[\leadsto \frac{1}{2} \cdot \frac{1}{\color{blue}{\frac{\frac{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}{c}}{4}}}\]
  15. Using strategy rm
  16. Applied div-inv0.3

    \[\leadsto \frac{1}{2} \cdot \frac{1}{\color{blue}{\frac{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}{c} \cdot \frac{1}{4}}}\]
  17. Applied add-sqr-sqrt0.3

    \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\frac{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}{c} \cdot \frac{1}{4}}\]
  18. Applied times-frac0.3

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

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

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

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

Reproduce

herbie shell --seed 2019318 
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (< 4.93038e-32 a 2.02824e31) (< 4.93038e-32 b 2.02824e31) (< 4.93038e-32 c 2.02824e31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))