Average Error: 43.9 → 11.2
Time: 27.9s
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 4.197456508925139 \cdot 10^{-05}:\\ \;\;\;\;\frac{\frac{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\ \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 4.197456508925139 \cdot 10^{-05}:\\
\;\;\;\;\frac{\frac{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\

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

\end{array}
double f(double a, double b, double c) {
        double r4508053 = b;
        double r4508054 = -r4508053;
        double r4508055 = r4508053 * r4508053;
        double r4508056 = 3.0;
        double r4508057 = a;
        double r4508058 = r4508056 * r4508057;
        double r4508059 = c;
        double r4508060 = r4508058 * r4508059;
        double r4508061 = r4508055 - r4508060;
        double r4508062 = sqrt(r4508061);
        double r4508063 = r4508054 + r4508062;
        double r4508064 = r4508063 / r4508058;
        return r4508064;
}

double f(double a, double b, double c) {
        double r4508065 = b;
        double r4508066 = 4.197456508925139e-05;
        bool r4508067 = r4508065 <= r4508066;
        double r4508068 = r4508065 * r4508065;
        double r4508069 = -3.0;
        double r4508070 = a;
        double r4508071 = c;
        double r4508072 = r4508070 * r4508071;
        double r4508073 = r4508069 * r4508072;
        double r4508074 = r4508068 + r4508073;
        double r4508075 = sqrt(r4508074);
        double r4508076 = r4508074 * r4508075;
        double r4508077 = r4508068 * r4508065;
        double r4508078 = r4508076 - r4508077;
        double r4508079 = r4508065 * r4508075;
        double r4508080 = r4508079 + r4508068;
        double r4508081 = r4508074 + r4508080;
        double r4508082 = r4508078 / r4508081;
        double r4508083 = 3.0;
        double r4508084 = r4508070 * r4508083;
        double r4508085 = r4508082 / r4508084;
        double r4508086 = -0.5;
        double r4508087 = r4508071 / r4508065;
        double r4508088 = r4508086 * r4508087;
        double r4508089 = r4508067 ? r4508085 : r4508088;
        return r4508089;
}

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

    1. Initial program 19.0

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

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

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

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

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

    if 4.197456508925139e-05 < b

    1. Initial program 45.4

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

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

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

Reproduce

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