Average Error: 29.0 → 16.5
Time: 25.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 107.32720840921216:\\ \;\;\;\;\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 \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + \left(b \cdot b - \left(3 \cdot c\right) \cdot a\right)\right) + 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 107.32720840921216:\\
\;\;\;\;\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 \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + \left(b \cdot b - \left(3 \cdot c\right) \cdot a\right)\right) + 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 r3731471 = b;
        double r3731472 = -r3731471;
        double r3731473 = r3731471 * r3731471;
        double r3731474 = 3.0;
        double r3731475 = a;
        double r3731476 = r3731474 * r3731475;
        double r3731477 = c;
        double r3731478 = r3731476 * r3731477;
        double r3731479 = r3731473 - r3731478;
        double r3731480 = sqrt(r3731479);
        double r3731481 = r3731472 + r3731480;
        double r3731482 = r3731481 / r3731476;
        return r3731482;
}

double f(double a, double b, double c) {
        double r3731483 = b;
        double r3731484 = 107.32720840921216;
        bool r3731485 = r3731483 <= r3731484;
        double r3731486 = r3731483 * r3731483;
        double r3731487 = 3.0;
        double r3731488 = c;
        double r3731489 = r3731487 * r3731488;
        double r3731490 = a;
        double r3731491 = r3731489 * r3731490;
        double r3731492 = r3731486 - r3731491;
        double r3731493 = sqrt(r3731492);
        double r3731494 = r3731492 * r3731493;
        double r3731495 = r3731486 * r3731483;
        double r3731496 = r3731494 - r3731495;
        double r3731497 = r3731483 * r3731493;
        double r3731498 = r3731497 + r3731492;
        double r3731499 = r3731498 + r3731486;
        double r3731500 = r3731496 / r3731499;
        double r3731501 = r3731490 * r3731487;
        double r3731502 = r3731500 / r3731501;
        double r3731503 = -0.5;
        double r3731504 = r3731488 / r3731483;
        double r3731505 = r3731503 * r3731504;
        double r3731506 = r3731485 ? r3731502 : r3731505;
        return r3731506;
}

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

    1. Initial program 15.5

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

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

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

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

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

    if 107.32720840921216 < b

    1. Initial program 35.1

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

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

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

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

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

Reproduce

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