Average Error: 43.2 → 11.7
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 1.143841598112384838194601800742677966127 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt[3]{\left(\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b\right) \cdot \left(\left(\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b\right) \cdot \left(\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b\right)\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 1.143841598112384838194601800742677966127 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sqrt[3]{\left(\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b\right) \cdot \left(\left(\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b\right) \cdot \left(\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b\right)\right)}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r4059827 = b;
        double r4059828 = -r4059827;
        double r4059829 = r4059827 * r4059827;
        double r4059830 = 3.0;
        double r4059831 = a;
        double r4059832 = r4059830 * r4059831;
        double r4059833 = c;
        double r4059834 = r4059832 * r4059833;
        double r4059835 = r4059829 - r4059834;
        double r4059836 = sqrt(r4059835);
        double r4059837 = r4059828 + r4059836;
        double r4059838 = r4059837 / r4059832;
        return r4059838;
}

double f(double a, double b, double c) {
        double r4059839 = b;
        double r4059840 = 1.1438415981123848e-06;
        bool r4059841 = r4059839 <= r4059840;
        double r4059842 = r4059839 * r4059839;
        double r4059843 = c;
        double r4059844 = 3.0;
        double r4059845 = a;
        double r4059846 = r4059844 * r4059845;
        double r4059847 = r4059843 * r4059846;
        double r4059848 = r4059842 - r4059847;
        double r4059849 = sqrt(r4059848);
        double r4059850 = r4059849 - r4059839;
        double r4059851 = r4059850 * r4059850;
        double r4059852 = r4059850 * r4059851;
        double r4059853 = cbrt(r4059852);
        double r4059854 = r4059853 / r4059846;
        double r4059855 = -0.5;
        double r4059856 = r4059843 / r4059839;
        double r4059857 = r4059855 * r4059856;
        double r4059858 = r4059841 ? r4059854 : r4059857;
        return r4059858;
}

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 < 1.1438415981123848e-06

    1. Initial program 14.9

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

      \[\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 add-cbrt-cube14.9

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

    if 1.1438415981123848e-06 < b

    1. Initial program 44.3

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

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

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

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

Reproduce

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