Average Error: 44.0 → 42.4
Time: 1.3m
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{{\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\mathsf{fma}\left(\left(c \cdot -3\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(c \cdot -3\right), a, \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{{\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\mathsf{fma}\left(\left(c \cdot -3\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(c \cdot -3\right), a, \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r21944937 = b;
        double r21944938 = -r21944937;
        double r21944939 = r21944937 * r21944937;
        double r21944940 = 3.0;
        double r21944941 = a;
        double r21944942 = r21944940 * r21944941;
        double r21944943 = c;
        double r21944944 = r21944942 * r21944943;
        double r21944945 = r21944939 - r21944944;
        double r21944946 = sqrt(r21944945);
        double r21944947 = r21944938 + r21944946;
        double r21944948 = r21944947 / r21944942;
        return r21944948;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r21944949 = c;
        double r21944950 = a;
        double r21944951 = -3.0;
        double r21944952 = r21944950 * r21944951;
        double r21944953 = b;
        double r21944954 = r21944953 * r21944953;
        double r21944955 = fma(r21944949, r21944952, r21944954);
        double r21944956 = 0.3333333333333333;
        double r21944957 = pow(r21944955, r21944956);
        double r21944958 = r21944949 * r21944951;
        double r21944959 = fma(r21944958, r21944950, r21944954);
        double r21944960 = r21944959 * r21944959;
        double r21944961 = cbrt(r21944960);
        double r21944962 = r21944957 * r21944961;
        double r21944963 = sqrt(r21944962);
        double r21944964 = sqrt(r21944963);
        double r21944965 = sqrt(r21944955);
        double r21944966 = sqrt(r21944965);
        double r21944967 = -r21944953;
        double r21944968 = fma(r21944964, r21944966, r21944967);
        double r21944969 = 3.0;
        double r21944970 = r21944969 * r21944950;
        double r21944971 = r21944968 / r21944970;
        return r21944971;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 44.0

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Simplified44.0

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)} - b}{3 \cdot a}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt44.0

    \[\leadsto \frac{\sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{3 \cdot a}\]
  5. Applied sqrt-prod44.0

    \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{3 \cdot a}\]
  6. Applied fma-neg43.4

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}}{3 \cdot a}\]
  7. Using strategy rm
  8. Applied add-cbrt-cube43.4

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  9. Using strategy rm
  10. Applied pow1/343.1

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{{\left(\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  11. Using strategy rm
  12. Applied unpow-prod-down43.1

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{{\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot {\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  13. Simplified42.4

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

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

Reproduce

herbie shell --seed 2019128 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical, 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) (* (* 3 a) c)))) (* 3 a)))