Average Error: 52.6 → 0.4
Time: 19.9s
Precision: 64
\[4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt a \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt b \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt c \lt 20282409603651670423947251286016\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{1}{2} \cdot \frac{\left(c \cdot a\right) \cdot 4}{-\left(a \cdot \sqrt{\mathsf{fma}\left(c, \left(-a\right) \cdot 4, b \cdot b\right)} + a \cdot b\right)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{2} \cdot \frac{\left(c \cdot a\right) \cdot 4}{-\left(a \cdot \sqrt{\mathsf{fma}\left(c, \left(-a\right) \cdot 4, b \cdot b\right)} + a \cdot b\right)}
double f(double a, double b, double c) {
        double r31365 = b;
        double r31366 = -r31365;
        double r31367 = r31365 * r31365;
        double r31368 = 4.0;
        double r31369 = a;
        double r31370 = r31368 * r31369;
        double r31371 = c;
        double r31372 = r31370 * r31371;
        double r31373 = r31367 - r31372;
        double r31374 = sqrt(r31373);
        double r31375 = r31366 + r31374;
        double r31376 = 2.0;
        double r31377 = r31376 * r31369;
        double r31378 = r31375 / r31377;
        return r31378;
}

double f(double a, double b, double c) {
        double r31379 = 1.0;
        double r31380 = 2.0;
        double r31381 = r31379 / r31380;
        double r31382 = c;
        double r31383 = a;
        double r31384 = r31382 * r31383;
        double r31385 = 4.0;
        double r31386 = r31384 * r31385;
        double r31387 = -r31383;
        double r31388 = r31387 * r31385;
        double r31389 = b;
        double r31390 = r31389 * r31389;
        double r31391 = fma(r31382, r31388, r31390);
        double r31392 = sqrt(r31391);
        double r31393 = r31383 * r31392;
        double r31394 = r31383 * r31389;
        double r31395 = r31393 + r31394;
        double r31396 = -r31395;
        double r31397 = r31386 / r31396;
        double r31398 = r31381 * r31397;
        return r31398;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.6

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

    \[\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(c \cdot a\right) \cdot 4}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Simplified0.4

    \[\leadsto \frac{\frac{0 + \left(c \cdot a\right) \cdot 4}{\color{blue}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, 4 \cdot \left(-a\right), {b}^{2}\right)}}}}{2 \cdot a}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{0 + \left(c \cdot a\right) \cdot 4}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, 4 \cdot \left(-a\right), {b}^{2}\right)}\right)}}}{2 \cdot a}\]
  8. Applied *-un-lft-identity0.4

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{2} \cdot \frac{\left(c \cdot a\right) \cdot 4}{\color{blue}{a \cdot \left(-\left(b + \sqrt{\mathsf{fma}\left(4, -c \cdot a, b \cdot b\right)}\right)\right)}}\]
  17. Using strategy rm
  18. Applied distribute-neg-in0.4

    \[\leadsto \frac{1}{2} \cdot \frac{\left(c \cdot a\right) \cdot 4}{a \cdot \color{blue}{\left(\left(-b\right) + \left(-\sqrt{\mathsf{fma}\left(4, -c \cdot a, b \cdot b\right)}\right)\right)}}\]
  19. Applied distribute-lft-in0.4

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

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

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

Reproduce

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