Average Error: 44.0 → 11.4
Time: 17.3s
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 6.961131476357276728544534868600712762543 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right)}}{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 6.961131476357276728544534868600712762543 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right)}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r4927845 = b;
        double r4927846 = -r4927845;
        double r4927847 = r4927845 * r4927845;
        double r4927848 = 3.0;
        double r4927849 = a;
        double r4927850 = r4927848 * r4927849;
        double r4927851 = c;
        double r4927852 = r4927850 * r4927851;
        double r4927853 = r4927847 - r4927852;
        double r4927854 = sqrt(r4927853);
        double r4927855 = r4927846 + r4927854;
        double r4927856 = r4927855 / r4927850;
        return r4927856;
}

double f(double a, double b, double c) {
        double r4927857 = b;
        double r4927858 = 6.961131476357277e-08;
        bool r4927859 = r4927857 <= r4927858;
        double r4927860 = r4927857 * r4927857;
        double r4927861 = c;
        double r4927862 = 3.0;
        double r4927863 = a;
        double r4927864 = r4927862 * r4927863;
        double r4927865 = r4927861 * r4927864;
        double r4927866 = r4927860 - r4927865;
        double r4927867 = sqrt(r4927866);
        double r4927868 = r4927866 * r4927867;
        double r4927869 = r4927860 * r4927857;
        double r4927870 = r4927868 - r4927869;
        double r4927871 = r4927857 * r4927867;
        double r4927872 = r4927871 + r4927860;
        double r4927873 = r4927866 + r4927872;
        double r4927874 = r4927870 / r4927873;
        double r4927875 = r4927874 / r4927864;
        double r4927876 = -0.5;
        double r4927877 = r4927861 / r4927857;
        double r4927878 = r4927876 * r4927877;
        double r4927879 = r4927859 ? r4927875 : r4927878;
        return r4927879;
}

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 < 6.961131476357277e-08

    1. Initial program 12.8

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

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

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

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

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

    if 6.961131476357277e-08 < b

    1. Initial program 44.8

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

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

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

Reproduce

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