Average Error: 28.3 → 0.4
Time: 17.7s
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{\left(a \cdot c\right) \cdot 4}{\left(-\left(a \cdot \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(\left(4 \cdot a\right) \cdot c, \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right), {b}^{4}\right)}} + a \cdot b\right)\right) \cdot 2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\left(a \cdot c\right) \cdot 4}{\left(-\left(a \cdot \sqrt{\frac{{b}^{6} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}{\mathsf{fma}\left(\left(4 \cdot a\right) \cdot c, \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right), {b}^{4}\right)}} + a \cdot b\right)\right) \cdot 2}
double f(double a, double b, double c) {
        double r41997 = b;
        double r41998 = -r41997;
        double r41999 = r41997 * r41997;
        double r42000 = 4.0;
        double r42001 = a;
        double r42002 = r42000 * r42001;
        double r42003 = c;
        double r42004 = r42002 * r42003;
        double r42005 = r41999 - r42004;
        double r42006 = sqrt(r42005);
        double r42007 = r41998 + r42006;
        double r42008 = 2.0;
        double r42009 = r42008 * r42001;
        double r42010 = r42007 / r42009;
        return r42010;
}

double f(double a, double b, double c) {
        double r42011 = a;
        double r42012 = c;
        double r42013 = r42011 * r42012;
        double r42014 = 4.0;
        double r42015 = r42013 * r42014;
        double r42016 = b;
        double r42017 = 6.0;
        double r42018 = pow(r42016, r42017);
        double r42019 = r42014 * r42011;
        double r42020 = r42019 * r42012;
        double r42021 = 3.0;
        double r42022 = pow(r42020, r42021);
        double r42023 = r42018 - r42022;
        double r42024 = r42014 * r42013;
        double r42025 = fma(r42016, r42016, r42024);
        double r42026 = 4.0;
        double r42027 = pow(r42016, r42026);
        double r42028 = fma(r42020, r42025, r42027);
        double r42029 = r42023 / r42028;
        double r42030 = sqrt(r42029);
        double r42031 = r42011 * r42030;
        double r42032 = r42011 * r42016;
        double r42033 = r42031 + r42032;
        double r42034 = -r42033;
        double r42035 = 2.0;
        double r42036 = r42034 * r42035;
        double r42037 = r42015 / r42036;
        return r42037;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.3

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

    \[\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 + \left(a \cdot c\right) \cdot 4}}{\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 + \left(a \cdot c\right) \cdot 4\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 + \left(a \cdot c\right) \cdot 4}{\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 + \left(a \cdot c\right) \cdot 4}{\color{blue}{\left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}}\]
  9. Using strategy rm
  10. Applied sub-neg0.4

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

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

    \[\leadsto \frac{0 + \left(a \cdot c\right) \cdot 4}{\left(\color{blue}{\left(-a\right) \cdot b} + a \cdot \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}\]
  13. Using strategy rm
  14. Applied flip3--0.4

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

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

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

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

Reproduce

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