Average Error: 44.3 → 10.9
Time: 23.8s
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 2.6223433915322215 \cdot 10^{-05}:\\ \;\;\;\;\frac{\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}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{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 2.6223433915322215 \cdot 10^{-05}:\\
\;\;\;\;\frac{\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}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r3938184 = b;
        double r3938185 = -r3938184;
        double r3938186 = r3938184 * r3938184;
        double r3938187 = 3.0;
        double r3938188 = a;
        double r3938189 = r3938187 * r3938188;
        double r3938190 = c;
        double r3938191 = r3938189 * r3938190;
        double r3938192 = r3938186 - r3938191;
        double r3938193 = sqrt(r3938192);
        double r3938194 = r3938185 + r3938193;
        double r3938195 = r3938194 / r3938189;
        return r3938195;
}

double f(double a, double b, double c) {
        double r3938196 = b;
        double r3938197 = 2.6223433915322215e-05;
        bool r3938198 = r3938196 <= r3938197;
        double r3938199 = r3938196 * r3938196;
        double r3938200 = c;
        double r3938201 = 3.0;
        double r3938202 = a;
        double r3938203 = r3938201 * r3938202;
        double r3938204 = r3938200 * r3938203;
        double r3938205 = r3938199 - r3938204;
        double r3938206 = sqrt(r3938205);
        double r3938207 = r3938206 * r3938206;
        double r3938208 = r3938207 - r3938199;
        double r3938209 = r3938196 + r3938206;
        double r3938210 = r3938208 / r3938209;
        double r3938211 = r3938210 / r3938203;
        double r3938212 = -0.5;
        double r3938213 = r3938200 / r3938196;
        double r3938214 = r3938212 * r3938213;
        double r3938215 = r3938198 ? r3938211 : r3938214;
        return r3938215;
}

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 < 2.6223433915322215e-05

    1. Initial program 18.0

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

      \[\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--18.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}\]

    if 2.6223433915322215e-05 < b

    1. Initial program 45.9

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

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

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

      \[\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 2.6223433915322215 \cdot 10^{-05}:\\ \;\;\;\;\frac{\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}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019139 
(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 a) c)))) (* 3 a)))