Average Error: 28.7 → 16.7
Time: 43.4s
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 242.4632640034452:\\ \;\;\;\;\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 + \left(b \cdot b - c \cdot \left(3 \cdot a\right)\right)\right) + b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 6879.115443247837:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 13378.421715408645:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b \cdot b}{\left(b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right) \cdot \left(3 \cdot a\right)}\\ \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 242.4632640034452:\\
\;\;\;\;\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 + \left(b \cdot b - c \cdot \left(3 \cdot a\right)\right)\right) + b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\

\mathbf{elif}\;b \le 6879.115443247837:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\

\mathbf{elif}\;b \le 13378.421715408645:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b \cdot b}{\left(b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right) \cdot \left(3 \cdot a\right)}\\

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

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r11226725 = b;
        double r11226726 = -r11226725;
        double r11226727 = r11226725 * r11226725;
        double r11226728 = 3.0;
        double r11226729 = a;
        double r11226730 = r11226728 * r11226729;
        double r11226731 = c;
        double r11226732 = r11226730 * r11226731;
        double r11226733 = r11226727 - r11226732;
        double r11226734 = sqrt(r11226733);
        double r11226735 = r11226726 + r11226734;
        double r11226736 = r11226735 / r11226730;
        return r11226736;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r11226737 = b;
        double r11226738 = 242.4632640034452;
        bool r11226739 = r11226737 <= r11226738;
        double r11226740 = r11226737 * r11226737;
        double r11226741 = c;
        double r11226742 = 3.0;
        double r11226743 = a;
        double r11226744 = r11226742 * r11226743;
        double r11226745 = r11226741 * r11226744;
        double r11226746 = r11226740 - r11226745;
        double r11226747 = sqrt(r11226746);
        double r11226748 = r11226746 * r11226747;
        double r11226749 = r11226740 * r11226737;
        double r11226750 = r11226748 - r11226749;
        double r11226751 = r11226740 + r11226746;
        double r11226752 = r11226737 * r11226747;
        double r11226753 = r11226751 + r11226752;
        double r11226754 = r11226750 / r11226753;
        double r11226755 = r11226754 / r11226744;
        double r11226756 = 6879.115443247837;
        bool r11226757 = r11226737 <= r11226756;
        double r11226758 = -0.5;
        double r11226759 = r11226741 / r11226737;
        double r11226760 = r11226758 * r11226759;
        double r11226761 = 13378.421715408645;
        bool r11226762 = r11226737 <= r11226761;
        double r11226763 = r11226747 * r11226747;
        double r11226764 = r11226763 - r11226740;
        double r11226765 = r11226737 + r11226747;
        double r11226766 = r11226765 * r11226744;
        double r11226767 = r11226764 / r11226766;
        double r11226768 = r11226762 ? r11226767 : r11226760;
        double r11226769 = r11226757 ? r11226760 : r11226768;
        double r11226770 = r11226739 ? r11226755 : r11226769;
        return r11226770;
}

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 3 regimes
  2. if b < 242.4632640034452

    1. Initial program 16.1

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

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

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

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

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

    if 242.4632640034452 < b < 6879.115443247837 or 13378.421715408645 < b

    1. Initial program 35.7

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Taylor expanded around inf 16.7

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}}\]

    if 6879.115443247837 < b < 13378.421715408645

    1. Initial program 29.2

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

      \[\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 flip--29.0

      \[\leadsto \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}}}{3 \cdot a}\]
    5. Applied associate-/l/29.0

      \[\leadsto \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}{\left(3 \cdot a\right) \cdot \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification16.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 242.4632640034452:\\ \;\;\;\;\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 + \left(b \cdot b - c \cdot \left(3 \cdot a\right)\right)\right) + b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 6879.115443247837:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 13378.421715408645:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b \cdot b}{\left(b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right) \cdot \left(3 \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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