Average Error: 28.8 → 16.8
Time: 21.3s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\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 116.90714088215695:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - \left(b \cdot b\right) \cdot b}{\left(b + \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a}\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + b \cdot b}}{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 116.90714088215695:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - \left(b \cdot b\right) \cdot b}{\left(b + \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a}\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + b \cdot b}}{a \cdot 3}\\

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

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3146773 = b;
        double r3146774 = -r3146773;
        double r3146775 = r3146773 * r3146773;
        double r3146776 = 3.0;
        double r3146777 = a;
        double r3146778 = r3146776 * r3146777;
        double r3146779 = c;
        double r3146780 = r3146778 * r3146779;
        double r3146781 = r3146775 - r3146780;
        double r3146782 = sqrt(r3146781);
        double r3146783 = r3146774 + r3146782;
        double r3146784 = r3146783 / r3146778;
        return r3146784;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3146785 = b;
        double r3146786 = 116.90714088215695;
        bool r3146787 = r3146785 <= r3146786;
        double r3146788 = r3146785 * r3146785;
        double r3146789 = 3.0;
        double r3146790 = c;
        double r3146791 = r3146789 * r3146790;
        double r3146792 = a;
        double r3146793 = r3146791 * r3146792;
        double r3146794 = r3146788 - r3146793;
        double r3146795 = sqrt(r3146794);
        double r3146796 = r3146794 * r3146795;
        double r3146797 = r3146788 * r3146785;
        double r3146798 = r3146796 - r3146797;
        double r3146799 = r3146785 + r3146795;
        double r3146800 = r3146799 * r3146795;
        double r3146801 = r3146800 + r3146788;
        double r3146802 = r3146798 / r3146801;
        double r3146803 = r3146792 * r3146789;
        double r3146804 = r3146802 / r3146803;
        double r3146805 = -0.5;
        double r3146806 = r3146790 / r3146785;
        double r3146807 = r3146805 * r3146806;
        double r3146808 = r3146787 ? r3146804 : r3146807;
        return r3146808;
}

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 < 116.90714088215695

    1. Initial program 15.7

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

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

      \[\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. Simplified15.1

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

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

    if 116.90714088215695 < b

    1. Initial program 34.7

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

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

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

Reproduce

herbie shell --seed 2019134 
(FPCore (a b c d)
  :name "Cubic critical, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))