Average Error: 52.6 → 0.1
Time: 7.1s
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{4 \cdot c}{\mathsf{fma}\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}, \left(-\sqrt{1}\right) + \sqrt{1}, -b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}} \cdot \frac{1}{2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{4 \cdot c}{\mathsf{fma}\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}, \left(-\sqrt{1}\right) + \sqrt{1}, -b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}} \cdot \frac{1}{2}
double f(double a, double b, double c) {
        double r37459 = b;
        double r37460 = -r37459;
        double r37461 = r37459 * r37459;
        double r37462 = 4.0;
        double r37463 = a;
        double r37464 = r37462 * r37463;
        double r37465 = c;
        double r37466 = r37464 * r37465;
        double r37467 = r37461 - r37466;
        double r37468 = sqrt(r37467);
        double r37469 = r37460 + r37468;
        double r37470 = 2.0;
        double r37471 = r37470 * r37463;
        double r37472 = r37469 / r37471;
        return r37472;
}

double f(double a, double b, double c) {
        double r37473 = 4.0;
        double r37474 = c;
        double r37475 = r37473 * r37474;
        double r37476 = b;
        double r37477 = r37476 * r37476;
        double r37478 = a;
        double r37479 = r37473 * r37478;
        double r37480 = r37479 * r37474;
        double r37481 = r37477 - r37480;
        double r37482 = sqrt(r37481);
        double r37483 = 1.0;
        double r37484 = sqrt(r37483);
        double r37485 = -r37484;
        double r37486 = r37485 + r37484;
        double r37487 = -r37476;
        double r37488 = fma(r37482, r37486, r37487);
        double r37489 = r37482 * r37484;
        double r37490 = r37488 - r37489;
        double r37491 = r37475 / r37490;
        double r37492 = 2.0;
        double r37493 = r37483 / r37492;
        double r37494 = r37491 * r37493;
        return r37494;
}

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 + 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 *-un-lft-identity0.4

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \color{blue}{\sqrt{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  8. 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{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  9. 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{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  10. Applied prod-diff0.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} \cdot \sqrt{1}\right) + \mathsf{fma}\left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}, \sqrt{1}, \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right)}}}{2 \cdot a}\]
  11. Simplified0.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} \cdot \sqrt{1}\right)} + \mathsf{fma}\left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}, \sqrt{1}, \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right)}}{2 \cdot a}\]
  12. Simplified0.4

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

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

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

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

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

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{\frac{4 \cdot \left(a \cdot c\right)}{a}}{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\right) + \left(-b\right)\right) + \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right)}}\]
  20. Using strategy rm
  21. Applied *-un-lft-identity0.2

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

    \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot \frac{4 \cdot \left(a \cdot c\right)}{a}}}{1 \cdot \left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\right) + \left(-b\right)\right) + \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right)\right)}\]
  23. Applied times-frac0.2

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

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

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

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

Reproduce

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