Average Error: 43.7 → 11.5
Time: 13.4s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\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 0.1273142573446926772984255649134865961969:\\ \;\;\;\;\frac{\frac{b \cdot b - \left(b \cdot b - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \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 0.1273142573446926772984255649134865961969:\\
\;\;\;\;\frac{\frac{b \cdot b - \left(b \cdot b - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r69201 = b;
        double r69202 = -r69201;
        double r69203 = r69201 * r69201;
        double r69204 = 3.0;
        double r69205 = a;
        double r69206 = r69204 * r69205;
        double r69207 = c;
        double r69208 = r69206 * r69207;
        double r69209 = r69203 - r69208;
        double r69210 = sqrt(r69209);
        double r69211 = r69202 + r69210;
        double r69212 = r69211 / r69206;
        return r69212;
}

double f(double a, double b, double c) {
        double r69213 = b;
        double r69214 = 0.12731425734469268;
        bool r69215 = r69213 <= r69214;
        double r69216 = r69213 * r69213;
        double r69217 = 3.0;
        double r69218 = a;
        double r69219 = c;
        double r69220 = r69218 * r69219;
        double r69221 = r69217 * r69220;
        double r69222 = r69216 - r69221;
        double r69223 = r69216 - r69222;
        double r69224 = -r69213;
        double r69225 = r69217 * r69218;
        double r69226 = r69225 * r69219;
        double r69227 = r69216 - r69226;
        double r69228 = sqrt(r69227);
        double r69229 = r69224 - r69228;
        double r69230 = r69223 / r69229;
        double r69231 = r69230 / r69225;
        double r69232 = -0.5;
        double r69233 = r69219 / r69213;
        double r69234 = r69232 * r69233;
        double r69235 = r69215 ? r69231 : r69234;
        return r69235;
}

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

    1. Initial program 23.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+23.6

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

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

    if 0.12731425734469268 < b

    1. Initial program 46.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around inf 9.8

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

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

Reproduce

herbie shell --seed 2019209 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e15) (< 1.11022e-16 b 9.0072e15) (< 1.11022e-16 c 9.0072e15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))