Average Error: 52.3 → 0.4
Time: 7.6s
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{1}{\frac{2 \cdot a}{4 \cdot \left(a \cdot c\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{1}{\frac{2 \cdot a}{4 \cdot \left(a \cdot c\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 r31096 = b;
        double r31097 = -r31096;
        double r31098 = r31096 * r31096;
        double r31099 = 4.0;
        double r31100 = a;
        double r31101 = r31099 * r31100;
        double r31102 = c;
        double r31103 = r31101 * r31102;
        double r31104 = r31098 - r31103;
        double r31105 = sqrt(r31104);
        double r31106 = r31097 + r31105;
        double r31107 = 2.0;
        double r31108 = r31107 * r31100;
        double r31109 = r31106 / r31108;
        return r31109;
}

double f(double a, double b, double c) {
        double r31110 = 1.0;
        double r31111 = 2.0;
        double r31112 = a;
        double r31113 = r31111 * r31112;
        double r31114 = 4.0;
        double r31115 = c;
        double r31116 = r31112 * r31115;
        double r31117 = r31114 * r31116;
        double r31118 = r31113 / r31117;
        double r31119 = b;
        double r31120 = -r31119;
        double r31121 = r31119 * r31119;
        double r31122 = r31114 * r31112;
        double r31123 = r31122 * r31115;
        double r31124 = r31121 - r31123;
        double r31125 = sqrt(r31124);
        double r31126 = r31120 - r31125;
        double r31127 = r31118 * r31126;
        double r31128 = r31110 / r31127;
        return r31128;
}

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 clear-num0.5

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

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

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

Reproduce

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