Average Error: 28.8 → 0.5
Time: 7.0s
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{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{2}{4}}}{\frac{1}{c}} \cdot \frac{\sqrt[3]{1}}{\mathsf{fma}\left(-1, b, -\sqrt{b \cdot 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{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{2}{4}}}{\frac{1}{c}} \cdot \frac{\sqrt[3]{1}}{\mathsf{fma}\left(-1, b, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}
double f(double a, double b, double c) {
        double r35270 = b;
        double r35271 = -r35270;
        double r35272 = r35270 * r35270;
        double r35273 = 4.0;
        double r35274 = a;
        double r35275 = r35273 * r35274;
        double r35276 = c;
        double r35277 = r35275 * r35276;
        double r35278 = r35272 - r35277;
        double r35279 = sqrt(r35278);
        double r35280 = r35271 + r35279;
        double r35281 = 2.0;
        double r35282 = r35281 * r35274;
        double r35283 = r35280 / r35282;
        return r35283;
}

double f(double a, double b, double c) {
        double r35284 = 1.0;
        double r35285 = cbrt(r35284);
        double r35286 = r35285 * r35285;
        double r35287 = 2.0;
        double r35288 = 4.0;
        double r35289 = r35287 / r35288;
        double r35290 = r35286 / r35289;
        double r35291 = c;
        double r35292 = r35284 / r35291;
        double r35293 = r35290 / r35292;
        double r35294 = -1.0;
        double r35295 = b;
        double r35296 = r35295 * r35295;
        double r35297 = a;
        double r35298 = r35288 * r35297;
        double r35299 = r35298 * r35291;
        double r35300 = r35296 - r35299;
        double r35301 = sqrt(r35300);
        double r35302 = -r35301;
        double r35303 = fma(r35294, r35295, r35302);
        double r35304 = r35285 / r35303;
        double r35305 = r35293 * r35304;
        return r35305;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

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

    \[\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 add-cube-cbrt0.9

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\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}}}}}{2 \cdot a}\]
  7. Applied add-sqr-sqrt0.9

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\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}}}}{2 \cdot a}\]
  8. Applied distribute-lft-neg-in0.9

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\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}}}}{2 \cdot a}\]
  9. Applied prod-diff0.9

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\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)}}}{2 \cdot a}\]
  10. Simplified0.5

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\left(\left(-\sqrt{b}\right) \cdot \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)}}{2 \cdot a}\]
  11. Simplified0.5

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

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

    \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot a}{4 \cdot \left(a \cdot c\right)} \cdot \mathsf{fma}\left(-1, b, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  15. Using strategy rm
  16. Applied add-cube-cbrt0.5

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

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

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

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

Reproduce

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