Average Error: 43.9 → 11.7
Time: 44.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 2.5705116510641293 \cdot 10^{-05}:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{elif}\;b \le 7.661477721949257:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \mathbf{elif}\;b \le 100.70919532052382:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \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 2.5705116510641293 \cdot 10^{-05}:\\
\;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\

\mathbf{elif}\;b \le 7.661477721949257:\\
\;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\

\mathbf{elif}\;b \le 100.70919532052382:\\
\;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r9542897 = b;
        double r9542898 = -r9542897;
        double r9542899 = r9542897 * r9542897;
        double r9542900 = 3.0;
        double r9542901 = a;
        double r9542902 = r9542900 * r9542901;
        double r9542903 = c;
        double r9542904 = r9542902 * r9542903;
        double r9542905 = r9542899 - r9542904;
        double r9542906 = sqrt(r9542905);
        double r9542907 = r9542898 + r9542906;
        double r9542908 = r9542907 / r9542902;
        return r9542908;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r9542909 = b;
        double r9542910 = 2.5705116510641293e-05;
        bool r9542911 = r9542909 <= r9542910;
        double r9542912 = r9542909 * r9542909;
        double r9542913 = c;
        double r9542914 = 3.0;
        double r9542915 = a;
        double r9542916 = r9542914 * r9542915;
        double r9542917 = r9542913 * r9542916;
        double r9542918 = r9542912 - r9542917;
        double r9542919 = sqrt(r9542918);
        double r9542920 = r9542918 * r9542919;
        double r9542921 = r9542912 * r9542909;
        double r9542922 = r9542920 - r9542921;
        double r9542923 = r9542909 * r9542919;
        double r9542924 = r9542923 + r9542912;
        double r9542925 = r9542919 * r9542919;
        double r9542926 = r9542924 + r9542925;
        double r9542927 = r9542916 * r9542926;
        double r9542928 = r9542922 / r9542927;
        double r9542929 = 7.661477721949257;
        bool r9542930 = r9542909 <= r9542929;
        double r9542931 = r9542913 / r9542909;
        double r9542932 = -0.5;
        double r9542933 = r9542931 * r9542932;
        double r9542934 = 100.70919532052382;
        bool r9542935 = r9542909 <= r9542934;
        double r9542936 = r9542935 ? r9542928 : r9542933;
        double r9542937 = r9542930 ? r9542933 : r9542936;
        double r9542938 = r9542911 ? r9542928 : r9542937;
        return r9542938;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if b < 2.5705116510641293e-05 or 7.661477721949257 < b < 100.70919532052382

    1. Initial program 24.5

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip3--24.6

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

      \[\leadsto \color{blue}{\frac{{\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3} - {b}^{3}}{\left(3 \cdot a\right) \cdot \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(b \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot b\right)\right)}}\]
    6. Simplified23.9

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

    if 2.5705116510641293e-05 < b < 7.661477721949257 or 100.70919532052382 < b

    1. Initial program 45.9

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Taylor expanded around inf 10.4

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 2.5705116510641293 \cdot 10^{-05}:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{elif}\;b \le 7.661477721949257:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \mathbf{elif}\;b \le 100.70919532052382:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019112 
(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)))