Average Error: 44.4 → 43.2
Time: 43.9s
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}\]
\[\begin{array}{l} \mathbf{if}\;b \le 148347232.94885397:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot \left(-3 \cdot c\right)\right)\right)} \cdot \mathsf{fma}\left(b, b, \left(a \cdot \left(-3 \cdot c\right)\right)\right) - \left(b \cdot b\right) \cdot b}{\left(\left(b \cdot \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)} + b \cdot b\right) + \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)}\right) \cdot \left(3 \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \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}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \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}}\right) \cdot \left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right)\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 148347232.94885397:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot \left(-3 \cdot c\right)\right)\right)} \cdot \mathsf{fma}\left(b, b, \left(a \cdot \left(-3 \cdot c\right)\right)\right) - \left(b \cdot b\right) \cdot b}{\left(\left(b \cdot \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)} + b \cdot b\right) + \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)}\right) \cdot \left(3 \cdot a\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \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}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \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}}\right) \cdot \left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right)\\

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r9213702 = b;
        double r9213703 = -r9213702;
        double r9213704 = r9213702 * r9213702;
        double r9213705 = 3.0;
        double r9213706 = a;
        double r9213707 = r9213705 * r9213706;
        double r9213708 = c;
        double r9213709 = r9213707 * r9213708;
        double r9213710 = r9213704 - r9213709;
        double r9213711 = sqrt(r9213710);
        double r9213712 = r9213703 + r9213711;
        double r9213713 = r9213712 / r9213707;
        return r9213713;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r9213714 = b;
        double r9213715 = 148347232.94885397;
        bool r9213716 = r9213714 <= r9213715;
        double r9213717 = a;
        double r9213718 = -3.0;
        double r9213719 = c;
        double r9213720 = r9213718 * r9213719;
        double r9213721 = r9213717 * r9213720;
        double r9213722 = fma(r9213714, r9213714, r9213721);
        double r9213723 = sqrt(r9213722);
        double r9213724 = r9213723 * r9213722;
        double r9213725 = r9213714 * r9213714;
        double r9213726 = r9213725 * r9213714;
        double r9213727 = r9213724 - r9213726;
        double r9213728 = r9213717 * r9213719;
        double r9213729 = fma(r9213718, r9213728, r9213725);
        double r9213730 = sqrt(r9213729);
        double r9213731 = r9213714 * r9213730;
        double r9213732 = r9213731 + r9213725;
        double r9213733 = r9213730 * r9213730;
        double r9213734 = r9213732 + r9213733;
        double r9213735 = 3.0;
        double r9213736 = r9213735 * r9213717;
        double r9213737 = r9213734 * r9213736;
        double r9213738 = r9213727 / r9213737;
        double r9213739 = sqrt(r9213730);
        double r9213740 = -r9213714;
        double r9213741 = fma(r9213739, r9213739, r9213740);
        double r9213742 = r9213741 / r9213736;
        double r9213743 = cbrt(r9213742);
        double r9213744 = r9213743 * r9213743;
        double r9213745 = -1.5;
        double r9213746 = r9213745 * r9213719;
        double r9213747 = r9213746 / r9213714;
        double r9213748 = cbrt(r9213747);
        double r9213749 = 0.3333333333333333;
        double r9213750 = cbrt(r9213749);
        double r9213751 = r9213748 * r9213750;
        double r9213752 = r9213744 * r9213751;
        double r9213753 = r9213716 ? r9213738 : r9213752;
        return r9213753;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 2 regimes
  2. if b < 148347232.94885397

    1. Initial program 35.9

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

      \[\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 flip3--36.0

      \[\leadsto \frac{\color{blue}{\frac{{\left(\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}\right)}^{3} - {b}^{3}}{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)} \cdot b\right)}}}{3 \cdot a}\]
    5. Applied associate-/l/36.0

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

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

    if 148347232.94885397 < b

    1. Initial program 53.6

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

      \[\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-sqrt53.1

      \[\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-neg52.4

      \[\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-cube-cbrt52.4

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\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}} \cdot \sqrt[3]{\frac{\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}}\right) \cdot \sqrt[3]{\frac{\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}}}\]
    8. Taylor expanded around 0 63.6

      \[\leadsto \left(\sqrt[3]{\frac{\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}} \cdot \sqrt[3]{\frac{\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}}\right) \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{3}} \cdot e^{\frac{1}{3} \cdot \left(\left(\log c + \log \frac{-3}{2}\right) - \log b\right)}\right)}\]
    9. Simplified51.6

      \[\leadsto \left(\sqrt[3]{\frac{\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}} \cdot \sqrt[3]{\frac{\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}}\right) \cdot \color{blue}{\left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 148347232.94885397:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot \left(-3 \cdot c\right)\right)\right)} \cdot \mathsf{fma}\left(b, b, \left(a \cdot \left(-3 \cdot c\right)\right)\right) - \left(b \cdot b\right) \cdot b}{\left(\left(b \cdot \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)} + b \cdot b\right) + \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \left(b \cdot b\right)\right)}\right) \cdot \left(3 \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \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}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(a \cdot c\right), \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}}\right) \cdot \left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right)\\ \end{array}\]

Reproduce

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