Average Error: 52.6 → 51.8
Time: 1.2m
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{\left(\sqrt[3]{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(\left(a \cdot c\right) \cdot -6\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(b \cdot b\right), \left(b \cdot b\right), \left(\left(\left(a \cdot c\right) \cdot 9\right) \cdot \left(a \cdot c\right)\right)\right)\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)} \cdot \sqrt[3]{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(\left(a \cdot c\right) \cdot -6\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(b \cdot b\right), \left(b \cdot b\right), \left(\left(\left(a \cdot c\right) \cdot 9\right) \cdot \left(a \cdot c\right)\right)\right)\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)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(\left(a \cdot c\right) \cdot -6\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(b \cdot b\right), \left(b \cdot b\right), \left(\left(\left(a \cdot c\right) \cdot 9\right) \cdot \left(a \cdot c\right)\right)\right)\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{\left(\sqrt[3]{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(\left(a \cdot c\right) \cdot -6\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(b \cdot b\right), \left(b \cdot b\right), \left(\left(\left(a \cdot c\right) \cdot 9\right) \cdot \left(a \cdot c\right)\right)\right)\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)} \cdot \sqrt[3]{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(\left(a \cdot c\right) \cdot -6\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(b \cdot b\right), \left(b \cdot b\right), \left(\left(\left(a \cdot c\right) \cdot 9\right) \cdot \left(a \cdot c\right)\right)\right)\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)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(\left(a \cdot c\right) \cdot -6\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(b \cdot b\right), \left(b \cdot b\right), \left(\left(\left(a \cdot c\right) \cdot 9\right) \cdot \left(a \cdot c\right)\right)\right)\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 r20115716 = b;
        double r20115717 = -r20115716;
        double r20115718 = r20115716 * r20115716;
        double r20115719 = 3.0;
        double r20115720 = a;
        double r20115721 = r20115719 * r20115720;
        double r20115722 = c;
        double r20115723 = r20115721 * r20115722;
        double r20115724 = r20115718 - r20115723;
        double r20115725 = sqrt(r20115724);
        double r20115726 = r20115717 + r20115725;
        double r20115727 = r20115726 / r20115721;
        return r20115727;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r20115728 = c;
        double r20115729 = a;
        double r20115730 = -3.0;
        double r20115731 = r20115729 * r20115730;
        double r20115732 = b;
        double r20115733 = r20115732 * r20115732;
        double r20115734 = fma(r20115728, r20115731, r20115733);
        double r20115735 = r20115729 * r20115728;
        double r20115736 = -6.0;
        double r20115737 = r20115735 * r20115736;
        double r20115738 = 9.0;
        double r20115739 = r20115735 * r20115738;
        double r20115740 = r20115739 * r20115735;
        double r20115741 = fma(r20115733, r20115733, r20115740);
        double r20115742 = fma(r20115737, r20115733, r20115741);
        double r20115743 = r20115734 * r20115742;
        double r20115744 = cbrt(r20115743);
        double r20115745 = sqrt(r20115744);
        double r20115746 = sqrt(r20115745);
        double r20115747 = sqrt(r20115734);
        double r20115748 = sqrt(r20115747);
        double r20115749 = -r20115732;
        double r20115750 = fma(r20115746, r20115748, r20115749);
        double r20115751 = cbrt(r20115750);
        double r20115752 = r20115751 * r20115751;
        double r20115753 = r20115752 * r20115751;
        double r20115754 = 3.0;
        double r20115755 = r20115754 * r20115729;
        double r20115756 = r20115753 / r20115755;
        return r20115756;
}

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.6

    \[\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-prod52.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}\]
  6. 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}\]
  7. Using strategy rm
  8. 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(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  9. Taylor expanded around -inf 51.8

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{\color{blue}{\left(\left({b}^{4} + 9 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right) - 6 \cdot \left(a \cdot \left({b}^{2} \cdot c\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}\]
  10. Simplified51.8

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

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

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