Average Error: 28.4 → 0.5
Time: 14.6s
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{c \cdot \left(4 \cdot a\right)}{2 \cdot \left(a \cdot \left(0 \cdot \sqrt{\mathsf{fma}\left(b, b, -c \cdot \left(4 \cdot a\right)\right)} + \mathsf{fma}\left(\sqrt{b}, -\sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)\right)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{c \cdot \left(4 \cdot a\right)}{2 \cdot \left(a \cdot \left(0 \cdot \sqrt{\mathsf{fma}\left(b, b, -c \cdot \left(4 \cdot a\right)\right)} + \mathsf{fma}\left(\sqrt{b}, -\sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)\right)}
double f(double a, double b, double c) {
        double r43203 = b;
        double r43204 = -r43203;
        double r43205 = r43203 * r43203;
        double r43206 = 4.0;
        double r43207 = a;
        double r43208 = r43206 * r43207;
        double r43209 = c;
        double r43210 = r43208 * r43209;
        double r43211 = r43205 - r43210;
        double r43212 = sqrt(r43211);
        double r43213 = r43204 + r43212;
        double r43214 = 2.0;
        double r43215 = r43214 * r43207;
        double r43216 = r43213 / r43215;
        return r43216;
}

double f(double a, double b, double c) {
        double r43217 = c;
        double r43218 = 4.0;
        double r43219 = a;
        double r43220 = r43218 * r43219;
        double r43221 = r43217 * r43220;
        double r43222 = 2.0;
        double r43223 = 0.0;
        double r43224 = b;
        double r43225 = -r43221;
        double r43226 = fma(r43224, r43224, r43225);
        double r43227 = sqrt(r43226);
        double r43228 = r43223 * r43227;
        double r43229 = sqrt(r43224);
        double r43230 = -r43229;
        double r43231 = r43224 * r43224;
        double r43232 = r43220 * r43217;
        double r43233 = r43231 - r43232;
        double r43234 = sqrt(r43233);
        double r43235 = -r43234;
        double r43236 = fma(r43229, r43230, r43235);
        double r43237 = r43228 + r43236;
        double r43238 = r43219 * r43237;
        double r43239 = r43222 * r43238;
        double r43240 = r43221 / r43239;
        return r43240;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.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-+28.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 + 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 div-inv0.5

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

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

    \[\leadsto \frac{0 + c \cdot \left(4 \cdot a\right)}{\color{blue}{2 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}}\]
  9. Using strategy rm
  10. Applied add-cube-cbrt0.9

    \[\leadsto \frac{0 + c \cdot \left(4 \cdot a\right)}{2 \cdot \left(a \cdot \left(\left(-b\right) - \color{blue}{\left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\right)\right)}\]
  11. Applied add-sqr-sqrt0.9

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

    \[\leadsto \frac{0 + c \cdot \left(4 \cdot a\right)}{2 \cdot \left(a \cdot \left(\color{blue}{\left(-\sqrt{b}\right) \cdot \sqrt{b}} - \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)\right)}\]
  13. Applied prod-diff0.9

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

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

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

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

Reproduce

herbie shell --seed 2019305 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (< 1.05367121277235087e-8 a 94906265.6242515594) (< 1.05367121277235087e-8 b 94906265.6242515594) (< 1.05367121277235087e-8 c 94906265.6242515594))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))