Average Error: 52.5 → 50.7
Time: 44.9s
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{{\left(\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\mathsf{fma}\left(\left(-3 \cdot c\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(-3 \cdot c\right), a, \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\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(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\mathsf{fma}\left(\left(-3 \cdot c\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(-3 \cdot c\right), a, \left(b \cdot b\right)\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\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 r10308683 = b;
        double r10308684 = -r10308683;
        double r10308685 = r10308683 * r10308683;
        double r10308686 = 3.0;
        double r10308687 = a;
        double r10308688 = r10308686 * r10308687;
        double r10308689 = c;
        double r10308690 = r10308688 * r10308689;
        double r10308691 = r10308685 - r10308690;
        double r10308692 = sqrt(r10308691);
        double r10308693 = r10308684 + r10308692;
        double r10308694 = r10308693 / r10308688;
        return r10308694;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r10308695 = -3.0;
        double r10308696 = a;
        double r10308697 = c;
        double r10308698 = r10308696 * r10308697;
        double r10308699 = b;
        double r10308700 = r10308699 * r10308699;
        double r10308701 = fma(r10308695, r10308698, r10308700);
        double r10308702 = 0.3333333333333333;
        double r10308703 = pow(r10308701, r10308702);
        double r10308704 = r10308695 * r10308697;
        double r10308705 = fma(r10308704, r10308696, r10308700);
        double r10308706 = r10308705 * r10308705;
        double r10308707 = cbrt(r10308706);
        double r10308708 = r10308703 * r10308707;
        double r10308709 = sqrt(r10308708);
        double r10308710 = sqrt(r10308709);
        double r10308711 = sqrt(r10308701);
        double r10308712 = sqrt(r10308711);
        double r10308713 = -r10308699;
        double r10308714 = fma(r10308710, r10308712, r10308713);
        double r10308715 = 3.0;
        double r10308716 = r10308715 * r10308696;
        double r10308717 = r10308714 / r10308716;
        return r10308717;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 52.5

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

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

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

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

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

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

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

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

Reproduce

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