Average Error: 44.1 → 0.2
Time: 19.4s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{c}{2 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{\frac{1}{4}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{c}{2 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{\frac{1}{4}}
double f(double a, double b, double c) {
        double r40952 = b;
        double r40953 = -r40952;
        double r40954 = r40952 * r40952;
        double r40955 = 4.0;
        double r40956 = a;
        double r40957 = r40955 * r40956;
        double r40958 = c;
        double r40959 = r40957 * r40958;
        double r40960 = r40954 - r40959;
        double r40961 = sqrt(r40960);
        double r40962 = r40953 + r40961;
        double r40963 = 2.0;
        double r40964 = r40963 * r40956;
        double r40965 = r40962 / r40964;
        return r40965;
}

double f(double a, double b, double c) {
        double r40966 = c;
        double r40967 = 2.0;
        double r40968 = b;
        double r40969 = -r40968;
        double r40970 = r40968 * r40968;
        double r40971 = 4.0;
        double r40972 = a;
        double r40973 = r40971 * r40972;
        double r40974 = r40973 * r40966;
        double r40975 = r40970 - r40974;
        double r40976 = sqrt(r40975);
        double r40977 = r40969 - r40976;
        double r40978 = r40967 * r40977;
        double r40979 = r40966 / r40978;
        double r40980 = 1.0;
        double r40981 = r40980 / r40971;
        double r40982 = r40979 / r40981;
        return r40982;
}

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 44.1

    \[\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-+44.1

    \[\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 + \left(a \cdot c\right) \cdot 4}}{\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 + \left(a \cdot c\right) \cdot 4\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 + \left(a \cdot c\right) \cdot 4}{\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 + \left(a \cdot c\right) \cdot 4}{\color{blue}{\left(2 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot a}}\]
  9. Using strategy rm
  10. Applied *-un-lft-identity0.4

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

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

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

    \[\leadsto \frac{1}{2 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \cdot \color{blue}{{\left(\frac{c \cdot \left(4 \cdot a\right)}{a}\right)}^{1}}\]
  15. Applied pow10.4

    \[\leadsto \color{blue}{{\left(\frac{1}{2 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}\right)}^{1}} \cdot {\left(\frac{c \cdot \left(4 \cdot a\right)}{a}\right)}^{1}\]
  16. Applied pow-prod-down0.4

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

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

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

Reproduce

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