Average Error: 44.1 → 11.2
Time: 17.5s
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.10455593216828488:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{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.10455593216828488:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1873501 = b;
        double r1873502 = -r1873501;
        double r1873503 = r1873501 * r1873501;
        double r1873504 = 4.0;
        double r1873505 = a;
        double r1873506 = r1873504 * r1873505;
        double r1873507 = c;
        double r1873508 = r1873506 * r1873507;
        double r1873509 = r1873503 - r1873508;
        double r1873510 = sqrt(r1873509);
        double r1873511 = r1873502 + r1873510;
        double r1873512 = 2.0;
        double r1873513 = r1873512 * r1873505;
        double r1873514 = r1873511 / r1873513;
        return r1873514;
}

double f(double a, double b, double c) {
        double r1873515 = b;
        double r1873516 = 0.10455593216828488;
        bool r1873517 = r1873515 <= r1873516;
        double r1873518 = r1873515 * r1873515;
        double r1873519 = a;
        double r1873520 = -4.0;
        double r1873521 = c;
        double r1873522 = r1873520 * r1873521;
        double r1873523 = r1873519 * r1873522;
        double r1873524 = r1873518 + r1873523;
        double r1873525 = sqrt(r1873524);
        double r1873526 = r1873524 * r1873525;
        double r1873527 = r1873518 * r1873515;
        double r1873528 = r1873526 - r1873527;
        double r1873529 = r1873515 * r1873525;
        double r1873530 = r1873529 + r1873518;
        double r1873531 = r1873524 + r1873530;
        double r1873532 = r1873528 / r1873531;
        double r1873533 = r1873532 / r1873519;
        double r1873534 = 2.0;
        double r1873535 = r1873533 / r1873534;
        double r1873536 = -2.0;
        double r1873537 = r1873521 / r1873515;
        double r1873538 = r1873536 * r1873537;
        double r1873539 = r1873538 / r1873534;
        double r1873540 = r1873517 ? r1873535 : r1873539;
        return r1873540;
}

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

    1. Initial program 23.0

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

      \[\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 flip3--23.0

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

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

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

    if 0.10455593216828488 < b

    1. Initial program 47.3

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

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

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

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

Reproduce

herbie shell --seed 2019162 
(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)))