Average Error: 52.4 → 0.5
Time: 7.0s
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)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{\sqrt[3]{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{3}}}\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)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{\sqrt[3]{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{3}}}\right)}}{2 \cdot a}
double f(double a, double b, double c) {
        double r39352 = b;
        double r39353 = -r39352;
        double r39354 = r39352 * r39352;
        double r39355 = 4.0;
        double r39356 = a;
        double r39357 = r39355 * r39356;
        double r39358 = c;
        double r39359 = r39357 * r39358;
        double r39360 = r39354 - r39359;
        double r39361 = sqrt(r39360);
        double r39362 = r39353 + r39361;
        double r39363 = 2.0;
        double r39364 = r39363 * r39356;
        double r39365 = r39362 / r39364;
        return r39365;
}

double f(double a, double b, double c) {
        double r39366 = 0.0;
        double r39367 = 4.0;
        double r39368 = a;
        double r39369 = c;
        double r39370 = r39368 * r39369;
        double r39371 = r39367 * r39370;
        double r39372 = r39366 + r39371;
        double r39373 = b;
        double r39374 = sqrt(r39373);
        double r39375 = -r39374;
        double r39376 = r39373 * r39373;
        double r39377 = r39367 * r39368;
        double r39378 = r39377 * r39369;
        double r39379 = r39376 - r39378;
        double r39380 = 3.0;
        double r39381 = pow(r39379, r39380);
        double r39382 = cbrt(r39381);
        double r39383 = sqrt(r39382);
        double r39384 = -r39383;
        double r39385 = fma(r39375, r39374, r39384);
        double r39386 = r39372 / r39385;
        double r39387 = 2.0;
        double r39388 = r39387 * r39368;
        double r39389 = r39386 / r39388;
        return r39389;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

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 add-sqr-sqrt0.5

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

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  9. Using strategy rm
  10. Applied add-cbrt-cube0.5

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{\color{blue}{\sqrt[3]{\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right) \cdot \left(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)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{\sqrt[3]{\color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{3}}}}\right)}}{2 \cdot a}\]
  12. Final simplification0.5

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{\sqrt[3]{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{3}}}\right)}}{2 \cdot a}\]

Reproduce

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