Average Error: 28.4 → 16.8
Time: 19.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 60.51244836482759836826517130248248577118:\\ \;\;\;\;\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{1}{\frac{a \cdot 3}{\frac{a}{\frac{b}{c}} \cdot -1.5}}\\ \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 60.51244836482759836826517130248248577118:\\
\;\;\;\;\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{1}{\frac{a \cdot 3}{\frac{a}{\frac{b}{c}} \cdot -1.5}}\\

\end{array}
double f(double a, double b, double c) {
        double r3398037 = b;
        double r3398038 = -r3398037;
        double r3398039 = r3398037 * r3398037;
        double r3398040 = 3.0;
        double r3398041 = a;
        double r3398042 = r3398040 * r3398041;
        double r3398043 = c;
        double r3398044 = r3398042 * r3398043;
        double r3398045 = r3398039 - r3398044;
        double r3398046 = sqrt(r3398045);
        double r3398047 = r3398038 + r3398046;
        double r3398048 = r3398047 / r3398042;
        return r3398048;
}

double f(double a, double b, double c) {
        double r3398049 = b;
        double r3398050 = 60.5124483648276;
        bool r3398051 = r3398049 <= r3398050;
        double r3398052 = r3398049 * r3398049;
        double r3398053 = c;
        double r3398054 = a;
        double r3398055 = 3.0;
        double r3398056 = r3398054 * r3398055;
        double r3398057 = r3398053 * r3398056;
        double r3398058 = r3398052 - r3398057;
        double r3398059 = sqrt(r3398058);
        double r3398060 = r3398058 * r3398059;
        double r3398061 = r3398052 * r3398049;
        double r3398062 = r3398060 - r3398061;
        double r3398063 = r3398049 * r3398059;
        double r3398064 = r3398063 + r3398052;
        double r3398065 = r3398058 + r3398064;
        double r3398066 = r3398062 / r3398065;
        double r3398067 = r3398066 / r3398056;
        double r3398068 = 1.0;
        double r3398069 = r3398049 / r3398053;
        double r3398070 = r3398054 / r3398069;
        double r3398071 = -1.5;
        double r3398072 = r3398070 * r3398071;
        double r3398073 = r3398056 / r3398072;
        double r3398074 = r3398068 / r3398073;
        double r3398075 = r3398051 ? r3398067 : r3398074;
        return r3398075;
}

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

    1. Initial program 14.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified14.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--14.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. Simplified13.9

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

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

    if 60.5124483648276 < b

    1. Initial program 34.2

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/l*18.0

      \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied clear-num18.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 60.51244836482759836826517130248248577118:\\ \;\;\;\;\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{1}{\frac{a \cdot 3}{\frac{a}{\frac{b}{c}} \cdot -1.5}}\\ \end{array}\]

Reproduce

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