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

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

\end{array}
double f(double a, double b, double c) {
        double r1645300 = b;
        double r1645301 = -r1645300;
        double r1645302 = r1645300 * r1645300;
        double r1645303 = 4.0;
        double r1645304 = a;
        double r1645305 = r1645303 * r1645304;
        double r1645306 = c;
        double r1645307 = r1645305 * r1645306;
        double r1645308 = r1645302 - r1645307;
        double r1645309 = sqrt(r1645308);
        double r1645310 = r1645301 + r1645309;
        double r1645311 = 2.0;
        double r1645312 = r1645311 * r1645304;
        double r1645313 = r1645310 / r1645312;
        return r1645313;
}

double f(double a, double b, double c) {
        double r1645314 = b;
        double r1645315 = 0.9098230818343235;
        bool r1645316 = r1645314 <= r1645315;
        double r1645317 = r1645314 * r1645314;
        double r1645318 = 4.0;
        double r1645319 = c;
        double r1645320 = a;
        double r1645321 = r1645319 * r1645320;
        double r1645322 = r1645318 * r1645321;
        double r1645323 = r1645317 - r1645322;
        double r1645324 = sqrt(r1645323);
        double r1645325 = r1645324 * r1645324;
        double r1645326 = r1645325 - r1645317;
        double r1645327 = r1645314 + r1645324;
        double r1645328 = r1645320 * r1645327;
        double r1645329 = r1645326 / r1645328;
        double r1645330 = 2.0;
        double r1645331 = r1645329 / r1645330;
        double r1645332 = -2.0;
        double r1645333 = r1645319 / r1645314;
        double r1645334 = r1645332 * r1645333;
        double r1645335 = r1645334 / r1645330;
        double r1645336 = r1645316 ? r1645331 : r1645335;
        return r1645336;
}

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.9098230818343235

    1. Initial program 24.5

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

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

      \[\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}}}{a}}{2}\]
    5. Applied associate-/l/24.5

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

    if 0.9098230818343235 < b

    1. Initial program 47.5

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

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

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

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

Reproduce

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