Average Error: 44.3 → 10.8
Time: 18.6s
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.03571012109534054540516123665838676970452:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{a}}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.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 0.03571012109534054540516123665838676970452:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{a}}{3}\\

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

\end{array}
double f(double a, double b, double c) {
        double r167035 = b;
        double r167036 = -r167035;
        double r167037 = r167035 * r167035;
        double r167038 = 3.0;
        double r167039 = a;
        double r167040 = r167038 * r167039;
        double r167041 = c;
        double r167042 = r167040 * r167041;
        double r167043 = r167037 - r167042;
        double r167044 = sqrt(r167043);
        double r167045 = r167036 + r167044;
        double r167046 = r167045 / r167040;
        return r167046;
}

double f(double a, double b, double c) {
        double r167047 = b;
        double r167048 = 0.035710121095340545;
        bool r167049 = r167047 <= r167048;
        double r167050 = r167047 * r167047;
        double r167051 = c;
        double r167052 = 3.0;
        double r167053 = a;
        double r167054 = r167052 * r167053;
        double r167055 = r167051 * r167054;
        double r167056 = r167050 - r167055;
        double r167057 = r167056 - r167050;
        double r167058 = sqrt(r167056);
        double r167059 = r167047 + r167058;
        double r167060 = r167057 / r167059;
        double r167061 = r167060 / r167053;
        double r167062 = r167061 / r167052;
        double r167063 = r167051 / r167047;
        double r167064 = -0.5;
        double r167065 = r167063 * r167064;
        double r167066 = r167049 ? r167062 : r167065;
        return r167066;
}

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.035710121095340545

    1. Initial program 21.3

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{a}}{3}}\]
    3. Using strategy rm
    4. Applied flip--21.2

      \[\leadsto \frac{\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}}}{a}}{3}\]
    5. Simplified20.2

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

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

    if 0.035710121095340545 < b

    1. Initial program 47.1

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}}\]
    4. Simplified9.6

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

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

Reproduce

herbie shell --seed 2019195 
(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.0 a) c)))) (* 3.0 a)))