Average Error: 43.9 → 0.2
Time: 23.8s
Precision: 64
\[1.11022 \cdot 10^{-16} \lt a \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt b \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt c \lt 9.0072 \cdot 10^{15}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\left(4 \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} - \left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)}{\mathsf{fma}\left(4 \cdot a, c, b \cdot b\right)}}}\right) \cdot \frac{1}{2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\left(4 \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} - \left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)}{\mathsf{fma}\left(4 \cdot a, c, b \cdot b\right)}}}\right) \cdot \frac{1}{2}
double f(double a, double b, double c) {
        double r44686 = b;
        double r44687 = -r44686;
        double r44688 = r44686 * r44686;
        double r44689 = 4.0;
        double r44690 = a;
        double r44691 = r44689 * r44690;
        double r44692 = c;
        double r44693 = r44691 * r44692;
        double r44694 = r44688 - r44693;
        double r44695 = sqrt(r44694);
        double r44696 = r44687 + r44695;
        double r44697 = 2.0;
        double r44698 = r44697 * r44690;
        double r44699 = r44696 / r44698;
        return r44699;
}

double f(double a, double b, double c) {
        double r44700 = 4.0;
        double r44701 = c;
        double r44702 = b;
        double r44703 = -r44702;
        double r44704 = 4.0;
        double r44705 = pow(r44702, r44704);
        double r44706 = a;
        double r44707 = r44700 * r44706;
        double r44708 = r44707 * r44701;
        double r44709 = r44708 * r44708;
        double r44710 = r44705 - r44709;
        double r44711 = r44702 * r44702;
        double r44712 = fma(r44707, r44701, r44711);
        double r44713 = r44710 / r44712;
        double r44714 = sqrt(r44713);
        double r44715 = r44703 - r44714;
        double r44716 = r44701 / r44715;
        double r44717 = r44700 * r44716;
        double r44718 = 1.0;
        double r44719 = 2.0;
        double r44720 = r44718 / r44719;
        double r44721 = r44717 * r44720;
        return r44721;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 43.9

    \[\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-+43.9

    \[\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 + c \cdot \left(4 \cdot a\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 + c \cdot \left(4 \cdot a\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  7. Applied *-un-lft-identity0.4

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

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

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

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{\left(4 \cdot a\right) \cdot c}{a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  12. Using strategy rm
  13. Applied times-frac0.2

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

    \[\leadsto \frac{1}{2} \cdot \left(\color{blue}{\frac{4}{1}} \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)\]
  15. Using strategy rm
  16. Applied flip--0.2

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

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

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

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

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))