Average Error: 28.6 → 16.3
Time: 18.2s
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\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 835.2343651472419878700748085975646972656:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(c \cdot \frac{a}{b}\right) \cdot -1.5}{3}}{a}\\ \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 835.2343651472419878700748085975646972656:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b \cdot b\right)}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(c \cdot \frac{a}{b}\right) \cdot -1.5}{3}}{a}\\

\end{array}
double f(double a, double b, double c) {
        double r2542904 = b;
        double r2542905 = -r2542904;
        double r2542906 = r2542904 * r2542904;
        double r2542907 = 3.0;
        double r2542908 = a;
        double r2542909 = r2542907 * r2542908;
        double r2542910 = c;
        double r2542911 = r2542909 * r2542910;
        double r2542912 = r2542906 - r2542911;
        double r2542913 = sqrt(r2542912);
        double r2542914 = r2542905 + r2542913;
        double r2542915 = r2542914 / r2542909;
        return r2542915;
}

double f(double a, double b, double c) {
        double r2542916 = b;
        double r2542917 = 835.234365147242;
        bool r2542918 = r2542916 <= r2542917;
        double r2542919 = r2542916 * r2542916;
        double r2542920 = c;
        double r2542921 = a;
        double r2542922 = 3.0;
        double r2542923 = r2542921 * r2542922;
        double r2542924 = r2542920 * r2542923;
        double r2542925 = r2542919 - r2542924;
        double r2542926 = sqrt(r2542925);
        double r2542927 = r2542925 * r2542926;
        double r2542928 = r2542919 * r2542916;
        double r2542929 = r2542927 - r2542928;
        double r2542930 = r2542916 * r2542926;
        double r2542931 = r2542930 + r2542919;
        double r2542932 = r2542925 + r2542931;
        double r2542933 = r2542929 / r2542932;
        double r2542934 = r2542933 / r2542923;
        double r2542935 = r2542921 / r2542916;
        double r2542936 = r2542920 * r2542935;
        double r2542937 = -1.5;
        double r2542938 = r2542936 * r2542937;
        double r2542939 = r2542938 / r2542922;
        double r2542940 = r2542939 / r2542921;
        double r2542941 = r2542918 ? r2542934 : r2542940;
        return r2542941;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 16.8

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

      \[\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--16.9

      \[\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. Simplified16.2

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

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

    if 835.234365147242 < b

    1. Initial program 36.3

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied div-inv16.4

      \[\leadsto \frac{-1.5 \cdot \color{blue}{\left(\left(a \cdot c\right) \cdot \frac{1}{b}\right)}}{3 \cdot a}\]
    6. Applied associate-*r*16.4

      \[\leadsto \frac{\color{blue}{\left(-1.5 \cdot \left(a \cdot c\right)\right) \cdot \frac{1}{b}}}{3 \cdot a}\]
    7. Using strategy rm
    8. Applied associate-/r*16.4

      \[\leadsto \color{blue}{\frac{\frac{\left(-1.5 \cdot \left(a \cdot c\right)\right) \cdot \frac{1}{b}}{3}}{a}}\]
    9. Simplified16.3

      \[\leadsto \frac{\color{blue}{\frac{\left(\frac{a}{b} \cdot c\right) \cdot -1.5}{3}}}{a}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 835.2343651472419878700748085975646972656:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(c \cdot \frac{a}{b}\right) \cdot -1.5}{3}}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019171 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))