Average Error: 44.0 → 10.9
Time: 57.0s
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 0.003048259879282381:\\ \;\;\;\;\left(\sqrt[3]{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}} \cdot \sqrt[3]{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}}\right) \cdot \sqrt[3]{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}}\\ \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 0.003048259879282381:\\
\;\;\;\;\left(\sqrt[3]{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}} \cdot \sqrt[3]{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}}\right) \cdot \sqrt[3]{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}}\\

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

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r14385698 = b;
        double r14385699 = -r14385698;
        double r14385700 = r14385698 * r14385698;
        double r14385701 = 3.0;
        double r14385702 = a;
        double r14385703 = r14385701 * r14385702;
        double r14385704 = c;
        double r14385705 = r14385703 * r14385704;
        double r14385706 = r14385700 - r14385705;
        double r14385707 = sqrt(r14385706);
        double r14385708 = r14385699 + r14385707;
        double r14385709 = r14385708 / r14385703;
        return r14385709;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r14385710 = b;
        double r14385711 = 0.003048259879282381;
        bool r14385712 = r14385710 <= r14385711;
        double r14385713 = r14385710 * r14385710;
        double r14385714 = c;
        double r14385715 = 3.0;
        double r14385716 = a;
        double r14385717 = r14385715 * r14385716;
        double r14385718 = r14385714 * r14385717;
        double r14385719 = r14385713 - r14385718;
        double r14385720 = sqrt(r14385719);
        double r14385721 = r14385720 - r14385710;
        double r14385722 = r14385721 / r14385717;
        double r14385723 = cbrt(r14385722);
        double r14385724 = r14385723 * r14385723;
        double r14385725 = r14385724 * r14385723;
        double r14385726 = -0.5;
        double r14385727 = r14385714 / r14385710;
        double r14385728 = r14385726 * r14385727;
        double r14385729 = r14385712 ? r14385725 : r14385728;
        return r14385729;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

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

    1. Initial program 19.9

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

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

    if 0.003048259879282381 < b

    1. Initial program 46.7

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

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

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

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

Reproduce

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