Average Error: 28.7 → 16.6
Time: 36.8s
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\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 5152.464935290847279247827827930450439453:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{a \cdot c}{\sqrt{b}}}{\sqrt{b}} \cdot -1.5}{a \cdot 3}\\ \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 5152.464935290847279247827827930450439453:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{a \cdot c}{\sqrt{b}}}{\sqrt{b}} \cdot -1.5}{a \cdot 3}\\

\end{array}
double f(double a, double b, double c) {
        double r2818667 = b;
        double r2818668 = -r2818667;
        double r2818669 = r2818667 * r2818667;
        double r2818670 = 3.0;
        double r2818671 = a;
        double r2818672 = r2818670 * r2818671;
        double r2818673 = c;
        double r2818674 = r2818672 * r2818673;
        double r2818675 = r2818669 - r2818674;
        double r2818676 = sqrt(r2818675);
        double r2818677 = r2818668 + r2818676;
        double r2818678 = r2818677 / r2818672;
        return r2818678;
}

double f(double a, double b, double c) {
        double r2818679 = b;
        double r2818680 = 5152.464935290847;
        bool r2818681 = r2818679 <= r2818680;
        double r2818682 = r2818679 * r2818679;
        double r2818683 = a;
        double r2818684 = 3.0;
        double r2818685 = c;
        double r2818686 = r2818684 * r2818685;
        double r2818687 = r2818683 * r2818686;
        double r2818688 = r2818682 - r2818687;
        double r2818689 = sqrt(r2818688);
        double r2818690 = r2818688 * r2818689;
        double r2818691 = r2818682 * r2818679;
        double r2818692 = r2818690 - r2818691;
        double r2818693 = r2818679 * r2818689;
        double r2818694 = r2818693 + r2818682;
        double r2818695 = r2818688 + r2818694;
        double r2818696 = r2818692 / r2818695;
        double r2818697 = r2818683 * r2818684;
        double r2818698 = r2818696 / r2818697;
        double r2818699 = r2818683 * r2818685;
        double r2818700 = sqrt(r2818679);
        double r2818701 = r2818699 / r2818700;
        double r2818702 = r2818701 / r2818700;
        double r2818703 = -1.5;
        double r2818704 = r2818702 * r2818703;
        double r2818705 = r2818704 / r2818697;
        double r2818706 = r2818681 ? r2818698 : r2818705;
        return r2818706;
}

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

    1. Initial program 18.9

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

      \[\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. Simplified18.3

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

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

    if 5152.464935290847 < b

    1. Initial program 38.2

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt15.0

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}}{3 \cdot a}\]
    6. Applied associate-/r*15.0

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

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

Reproduce

herbie shell --seed 2019168 
(FPCore (a b c)
  :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.0 a) c)))) (* 3.0 a)))