Average Error: 44.0 → 11.0
Time: 29.8s
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 5.343652512340826 \cdot 10^{-05}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b \cdot b}{\left(b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right) \cdot \left(3 \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \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 5.343652512340826 \cdot 10^{-05}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b \cdot b}{\left(b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right) \cdot \left(3 \cdot a\right)}\\

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

\end{array}
double f(double a, double b, double c) {
        double r3770309 = b;
        double r3770310 = -r3770309;
        double r3770311 = r3770309 * r3770309;
        double r3770312 = 3.0;
        double r3770313 = a;
        double r3770314 = r3770312 * r3770313;
        double r3770315 = c;
        double r3770316 = r3770314 * r3770315;
        double r3770317 = r3770311 - r3770316;
        double r3770318 = sqrt(r3770317);
        double r3770319 = r3770310 + r3770318;
        double r3770320 = r3770319 / r3770314;
        return r3770320;
}

double f(double a, double b, double c) {
        double r3770321 = b;
        double r3770322 = 5.343652512340826e-05;
        bool r3770323 = r3770321 <= r3770322;
        double r3770324 = r3770321 * r3770321;
        double r3770325 = c;
        double r3770326 = 3.0;
        double r3770327 = a;
        double r3770328 = r3770326 * r3770327;
        double r3770329 = r3770325 * r3770328;
        double r3770330 = r3770324 - r3770329;
        double r3770331 = sqrt(r3770330);
        double r3770332 = r3770331 * r3770331;
        double r3770333 = r3770332 - r3770324;
        double r3770334 = r3770321 + r3770331;
        double r3770335 = r3770334 * r3770328;
        double r3770336 = r3770333 / r3770335;
        double r3770337 = -0.5;
        double r3770338 = r3770325 / r3770321;
        double r3770339 = r3770337 * r3770338;
        double r3770340 = r3770323 ? r3770336 : r3770339;
        return r3770340;
}

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 < 5.343652512340826e-05

    1. Initial program 18.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified18.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 flip--18.4

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

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

    if 5.343652512340826e-05 < b

    1. Initial program 45.8

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

      \[\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.5

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

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

Reproduce

herbie shell --seed 2019142 
(FPCore (a b c)
  :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)))