Average Error: 43.8 → 0.2
Time: 5.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}\]
\[\frac{1}{2} \cdot \frac{\frac{c \cdot 4}{1}}{\left(-b\right) - \sqrt{\frac{\mathsf{fma}\left(-\left(4 \cdot a\right) \cdot \left(4 \cdot a\right), c \cdot c, {b}^{4}\right)}{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{2} \cdot \frac{\frac{c \cdot 4}{1}}{\left(-b\right) - \sqrt{\frac{\mathsf{fma}\left(-\left(4 \cdot a\right) \cdot \left(4 \cdot a\right), c \cdot c, {b}^{4}\right)}{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}
double f(double a, double b, double c) {
        double r32695 = b;
        double r32696 = -r32695;
        double r32697 = r32695 * r32695;
        double r32698 = 4.0;
        double r32699 = a;
        double r32700 = r32698 * r32699;
        double r32701 = c;
        double r32702 = r32700 * r32701;
        double r32703 = r32697 - r32702;
        double r32704 = sqrt(r32703);
        double r32705 = r32696 + r32704;
        double r32706 = 2.0;
        double r32707 = r32706 * r32699;
        double r32708 = r32705 / r32707;
        return r32708;
}

double f(double a, double b, double c) {
        double r32709 = 1.0;
        double r32710 = 2.0;
        double r32711 = r32709 / r32710;
        double r32712 = c;
        double r32713 = 4.0;
        double r32714 = r32712 * r32713;
        double r32715 = r32714 / r32709;
        double r32716 = b;
        double r32717 = -r32716;
        double r32718 = a;
        double r32719 = r32713 * r32718;
        double r32720 = r32719 * r32719;
        double r32721 = -r32720;
        double r32722 = r32712 * r32712;
        double r32723 = 4.0;
        double r32724 = pow(r32716, r32723);
        double r32725 = fma(r32721, r32722, r32724);
        double r32726 = r32719 * r32712;
        double r32727 = fma(r32716, r32716, r32726);
        double r32728 = r32725 / r32727;
        double r32729 = sqrt(r32728);
        double r32730 = r32717 - r32729;
        double r32731 = r32715 / r32730;
        double r32732 = r32711 * r32731;
        return r32732;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 43.8

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

    \[\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)}{\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 + 4 \cdot \left(a \cdot c\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 + 4 \cdot \left(a \cdot c\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 + 4 \cdot \left(a \cdot c\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 + 4 \cdot \left(a \cdot c\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{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  12. Using strategy rm
  13. Applied associate-/r*0.2

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

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

    \[\leadsto \frac{1}{2} \cdot \frac{\frac{c \cdot 4}{1}}{\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}}}}\]
  17. Simplified0.2

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

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

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

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))