Average Error: 52.3 → 0.5
Time: 7.4s
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{0 + 4 \cdot \left(a \cdot c\right)}{\left(\left(-\sqrt{b}\right) \cdot \sqrt{b} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-1\right) + 1\right)}}{2 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(\left(-\sqrt{b}\right) \cdot \sqrt{b} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-1\right) + 1\right)}}{2 \cdot a}
double f(double a, double b, double c) {
        double r39011 = b;
        double r39012 = -r39011;
        double r39013 = r39011 * r39011;
        double r39014 = 4.0;
        double r39015 = a;
        double r39016 = r39014 * r39015;
        double r39017 = c;
        double r39018 = r39016 * r39017;
        double r39019 = r39013 - r39018;
        double r39020 = sqrt(r39019);
        double r39021 = r39012 + r39020;
        double r39022 = 2.0;
        double r39023 = r39022 * r39015;
        double r39024 = r39021 / r39023;
        return r39024;
}

double f(double a, double b, double c) {
        double r39025 = 0.0;
        double r39026 = 4.0;
        double r39027 = a;
        double r39028 = c;
        double r39029 = r39027 * r39028;
        double r39030 = r39026 * r39029;
        double r39031 = r39025 + r39030;
        double r39032 = b;
        double r39033 = sqrt(r39032);
        double r39034 = -r39033;
        double r39035 = r39034 * r39033;
        double r39036 = r39032 * r39032;
        double r39037 = r39026 * r39027;
        double r39038 = r39037 * r39028;
        double r39039 = r39036 - r39038;
        double r39040 = sqrt(r39039);
        double r39041 = r39035 - r39040;
        double r39042 = 1.0;
        double r39043 = -r39042;
        double r39044 = r39043 + r39042;
        double r39045 = r39040 * r39044;
        double r39046 = r39041 + r39045;
        double r39047 = r39031 / r39046;
        double r39048 = 2.0;
        double r39049 = r39048 * r39027;
        double r39050 = r39047 / r39049;
        return r39050;
}

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 add-cube-cbrt0.9

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-\color{blue}{\sqrt{b} \cdot \sqrt{b}}\right) - \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  8. Applied distribute-lft-neg-in0.9

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\left(-\sqrt{b}\right) \cdot \sqrt{b}} - \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  9. Applied prod-diff0.9

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

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

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

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

Reproduce

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