Average Error: 52.6 → 51.8
Time: 26.2s
Precision: 64
\[4.930380657631324 \cdot 10^{-32} \lt a \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt b \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt c \lt 2.028240960365167 \cdot 10^{+31}\]
\[\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{\sqrt[3]{\left(\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \left(\sqrt{\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)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(-3 \cdot a\right) \cdot c\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}\]
\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{\sqrt[3]{\left(\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \left(\sqrt{\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)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(-3 \cdot a\right) \cdot c\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r2253913 = b;
        double r2253914 = -r2253913;
        double r2253915 = r2253913 * r2253913;
        double r2253916 = 3.0;
        double r2253917 = a;
        double r2253918 = r2253916 * r2253917;
        double r2253919 = c;
        double r2253920 = r2253918 * r2253919;
        double r2253921 = r2253915 - r2253920;
        double r2253922 = sqrt(r2253921);
        double r2253923 = r2253914 + r2253922;
        double r2253924 = r2253923 / r2253918;
        return r2253924;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r2253925 = c;
        double r2253926 = -3.0;
        double r2253927 = a;
        double r2253928 = r2253926 * r2253927;
        double r2253929 = b;
        double r2253930 = r2253929 * r2253929;
        double r2253931 = fma(r2253925, r2253928, r2253930);
        double r2253932 = sqrt(r2253931);
        double r2253933 = r2253932 * r2253931;
        double r2253934 = r2253932 * r2253933;
        double r2253935 = r2253934 * r2253931;
        double r2253936 = cbrt(r2253935);
        double r2253937 = sqrt(r2253936);
        double r2253938 = sqrt(r2253937);
        double r2253939 = r2253928 * r2253925;
        double r2253940 = fma(r2253929, r2253929, r2253939);
        double r2253941 = sqrt(r2253940);
        double r2253942 = sqrt(r2253941);
        double r2253943 = -r2253929;
        double r2253944 = fma(r2253938, r2253942, r2253943);
        double r2253945 = 3.0;
        double r2253946 = r2253927 * r2253945;
        double r2253947 = r2253944 / r2253946;
        return r2253947;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 52.6

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

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

    \[\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}\]
  5. Applied fma-neg51.7

    \[\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}\]
  6. Taylor expanded around 0 51.7

    \[\leadsto \frac{\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{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  7. Simplified51.7

    \[\leadsto \frac{\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{\color{blue}{\mathsf{fma}\left(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  8. Using strategy rm
  9. Applied add-cbrt-cube51.8

    \[\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(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  10. Simplified51.8

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

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \color{blue}{\left(\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)}\right)}\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  13. Applied associate-*r*51.8

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

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\left(\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \left(\sqrt{\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)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(-3 \cdot a\right) \cdot c\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}\]

Reproduce

herbie shell --seed 2019128 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))