Average Error: 28.8 → 16.3
Time: 17.6s
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 6015.720092576997558353468775749206542969:\\ \;\;\;\;\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}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \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 6015.720092576997558353468775749206542969:\\
\;\;\;\;\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}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r4180980 = b;
        double r4180981 = -r4180980;
        double r4180982 = r4180980 * r4180980;
        double r4180983 = 3.0;
        double r4180984 = a;
        double r4180985 = r4180983 * r4180984;
        double r4180986 = c;
        double r4180987 = r4180985 * r4180986;
        double r4180988 = r4180982 - r4180987;
        double r4180989 = sqrt(r4180988);
        double r4180990 = r4180981 + r4180989;
        double r4180991 = r4180990 / r4180985;
        return r4180991;
}

double f(double a, double b, double c) {
        double r4180992 = b;
        double r4180993 = 6015.720092576998;
        bool r4180994 = r4180992 <= r4180993;
        double r4180995 = r4180992 * r4180992;
        double r4180996 = c;
        double r4180997 = a;
        double r4180998 = 3.0;
        double r4180999 = r4180997 * r4180998;
        double r4181000 = r4180996 * r4180999;
        double r4181001 = r4180995 - r4181000;
        double r4181002 = sqrt(r4181001);
        double r4181003 = r4181001 * r4181002;
        double r4181004 = r4180995 * r4180992;
        double r4181005 = r4181003 - r4181004;
        double r4181006 = r4180992 * r4181002;
        double r4181007 = r4181006 + r4180995;
        double r4181008 = r4181001 + r4181007;
        double r4181009 = r4181005 / r4181008;
        double r4181010 = r4181009 / r4180999;
        double r4181011 = -0.5;
        double r4181012 = r4180996 / r4180992;
        double r4181013 = r4181011 * r4181012;
        double r4181014 = r4180994 ? r4181010 : r4181013;
        return r4181014;
}

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 < 6015.720092576998

    1. Initial program 18.7

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

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

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

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

      \[\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 6015.720092576998 < b

    1. Initial program 38.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 6015.720092576997558353468775749206542969:\\ \;\;\;\;\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}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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