Average Error: 52.8 → 0.4
Time: 25.5s
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{c \cdot \left(4 \cdot a\right)}{\left(a \cdot 2\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{c \cdot \left(4 \cdot a\right)}{\left(a \cdot 2\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 r32805 = b;
        double r32806 = -r32805;
        double r32807 = r32805 * r32805;
        double r32808 = 4.0;
        double r32809 = a;
        double r32810 = r32808 * r32809;
        double r32811 = c;
        double r32812 = r32810 * r32811;
        double r32813 = r32807 - r32812;
        double r32814 = sqrt(r32813);
        double r32815 = r32806 + r32814;
        double r32816 = 2.0;
        double r32817 = r32816 * r32809;
        double r32818 = r32815 / r32817;
        return r32818;
}

double f(double a, double b, double c) {
        double r32819 = c;
        double r32820 = 4.0;
        double r32821 = a;
        double r32822 = r32820 * r32821;
        double r32823 = r32819 * r32822;
        double r32824 = 2.0;
        double r32825 = r32821 * r32824;
        double r32826 = b;
        double r32827 = -r32826;
        double r32828 = r32826 * r32826;
        double r32829 = r32822 * r32819;
        double r32830 = r32828 - r32829;
        double r32831 = sqrt(r32830);
        double r32832 = r32827 - r32831;
        double r32833 = r32825 * r32832;
        double r32834 = r32823 / r32833;
        return r32834;
}

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

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

    \[\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 + c \cdot \left(4 \cdot a\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 + c \cdot \left(4 \cdot a\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 + c \cdot \left(4 \cdot a\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 + c \cdot \left(4 \cdot a\right)}{\color{blue}{\left(a \cdot 2\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  9. Final simplification0.4

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

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))