Average Error: 43.9 → 11.5
Time: 37.7s
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.0 \cdot a\right) \cdot c}}{3.0 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 0.2283921088226662:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(a \cdot c\right) \cdot 3.0\right) \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3.0} - \left(b \cdot b\right) \cdot b}{\left(b \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3.0} + \left(b \cdot b - \left(a \cdot c\right) \cdot 3.0\right)\right) + b \cdot b}}{3.0 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c}}{3.0 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 0.2283921088226662:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(a \cdot c\right) \cdot 3.0\right) \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3.0} - \left(b \cdot b\right) \cdot b}{\left(b \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3.0} + \left(b \cdot b - \left(a \cdot c\right) \cdot 3.0\right)\right) + b \cdot b}}{3.0 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r4074775 = b;
        double r4074776 = -r4074775;
        double r4074777 = r4074775 * r4074775;
        double r4074778 = 3.0;
        double r4074779 = a;
        double r4074780 = r4074778 * r4074779;
        double r4074781 = c;
        double r4074782 = r4074780 * r4074781;
        double r4074783 = r4074777 - r4074782;
        double r4074784 = sqrt(r4074783);
        double r4074785 = r4074776 + r4074784;
        double r4074786 = r4074785 / r4074780;
        return r4074786;
}

double f(double a, double b, double c) {
        double r4074787 = b;
        double r4074788 = 0.2283921088226662;
        bool r4074789 = r4074787 <= r4074788;
        double r4074790 = r4074787 * r4074787;
        double r4074791 = a;
        double r4074792 = c;
        double r4074793 = r4074791 * r4074792;
        double r4074794 = 3.0;
        double r4074795 = r4074793 * r4074794;
        double r4074796 = r4074790 - r4074795;
        double r4074797 = sqrt(r4074796);
        double r4074798 = r4074796 * r4074797;
        double r4074799 = r4074790 * r4074787;
        double r4074800 = r4074798 - r4074799;
        double r4074801 = r4074787 * r4074797;
        double r4074802 = r4074801 + r4074796;
        double r4074803 = r4074802 + r4074790;
        double r4074804 = r4074800 / r4074803;
        double r4074805 = r4074794 * r4074791;
        double r4074806 = r4074804 / r4074805;
        double r4074807 = -0.5;
        double r4074808 = r4074792 / r4074787;
        double r4074809 = r4074807 * r4074808;
        double r4074810 = r4074789 ? r4074806 : r4074809;
        return r4074810;
}

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

    1. Initial program 23.9

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c} - b}{3.0 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip3--24.0

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

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

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

    if 0.2283921088226662 < b

    1. Initial program 47.3

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

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

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

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

Reproduce

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