Average Error: 28.2 → 16.6
Time: 33.2s
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(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 710.3936434177851424465188756585121154785:\\ \;\;\;\;\frac{\frac{\frac{b \cdot b - \left(b \cdot b + c \cdot \left(4 \cdot a\right)\right)}{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b}}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 710.3936434177851424465188756585121154785:\\
\;\;\;\;\frac{\frac{\frac{b \cdot b - \left(b \cdot b + c \cdot \left(4 \cdot a\right)\right)}{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r64326 = b;
        double r64327 = -r64326;
        double r64328 = r64326 * r64326;
        double r64329 = 4.0;
        double r64330 = a;
        double r64331 = r64329 * r64330;
        double r64332 = c;
        double r64333 = r64331 * r64332;
        double r64334 = r64328 - r64333;
        double r64335 = sqrt(r64334);
        double r64336 = r64327 + r64335;
        double r64337 = 2.0;
        double r64338 = r64337 * r64330;
        double r64339 = r64336 / r64338;
        return r64339;
}

double f(double a, double b, double c) {
        double r64340 = b;
        double r64341 = 710.3936434177851;
        bool r64342 = r64340 <= r64341;
        double r64343 = r64340 * r64340;
        double r64344 = c;
        double r64345 = 4.0;
        double r64346 = a;
        double r64347 = r64345 * r64346;
        double r64348 = r64344 * r64347;
        double r64349 = r64343 + r64348;
        double r64350 = r64343 - r64349;
        double r64351 = r64343 - r64348;
        double r64352 = sqrt(r64351);
        double r64353 = r64352 + r64340;
        double r64354 = r64350 / r64353;
        double r64355 = 2.0;
        double r64356 = r64354 / r64355;
        double r64357 = r64356 / r64346;
        double r64358 = -1.0;
        double r64359 = r64344 / r64340;
        double r64360 = r64358 * r64359;
        double r64361 = r64342 ? r64357 : r64360;
        return r64361;
}

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

    1. Initial program 17.1

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b \cdot b}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}}}{2}}{a}\]
    5. Simplified16.1

      \[\leadsto \frac{\frac{\frac{\color{blue}{b \cdot b - \left(\left(4 \cdot a\right) \cdot c + b \cdot b\right)}}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}}{2}}{a}\]
    6. Simplified16.1

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

    if 710.3936434177851 < b

    1. Initial program 35.5

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

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

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

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

Reproduce

herbie shell --seed 2019194 
(FPCore (a b c)
  :name "Quadratic roots, 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) (* (* 4.0 a) c)))) (* 2.0 a)))