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

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

\end{array}
double f(double a, double b, double c) {
        double r1172695 = b;
        double r1172696 = -r1172695;
        double r1172697 = r1172695 * r1172695;
        double r1172698 = 4.0;
        double r1172699 = a;
        double r1172700 = r1172698 * r1172699;
        double r1172701 = c;
        double r1172702 = r1172700 * r1172701;
        double r1172703 = r1172697 - r1172702;
        double r1172704 = sqrt(r1172703);
        double r1172705 = r1172696 + r1172704;
        double r1172706 = 2.0;
        double r1172707 = r1172706 * r1172699;
        double r1172708 = r1172705 / r1172707;
        return r1172708;
}

double f(double a, double b, double c) {
        double r1172709 = b;
        double r1172710 = 2650.8680979433148;
        bool r1172711 = r1172709 <= r1172710;
        double r1172712 = r1172709 * r1172709;
        double r1172713 = c;
        double r1172714 = a;
        double r1172715 = r1172713 * r1172714;
        double r1172716 = -4.0;
        double r1172717 = r1172715 * r1172716;
        double r1172718 = r1172712 + r1172717;
        double r1172719 = sqrt(r1172718);
        double r1172720 = r1172718 * r1172719;
        double r1172721 = r1172712 * r1172709;
        double r1172722 = r1172720 - r1172721;
        double r1172723 = r1172709 + r1172719;
        double r1172724 = r1172709 * r1172723;
        double r1172725 = r1172718 + r1172724;
        double r1172726 = r1172722 / r1172725;
        double r1172727 = r1172726 / r1172714;
        double r1172728 = 2.0;
        double r1172729 = r1172727 / r1172728;
        double r1172730 = -2.0;
        double r1172731 = r1172713 / r1172709;
        double r1172732 = r1172730 * r1172731;
        double r1172733 = r1172732 / r1172728;
        double r1172734 = r1172711 ? r1172729 : r1172733;
        return r1172734;
}

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

    1. Initial program 18.1

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

      \[\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--18.1

      \[\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. Simplified17.4

      \[\leadsto \frac{\frac{\frac{\color{blue}{\sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)} \cdot \left(b \cdot b + -4 \cdot \left(c \cdot a\right)\right) - \left(b \cdot b\right) \cdot b}}{\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. Simplified17.4

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

    if 2650.8680979433148 < b

    1. Initial program 37.5

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

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

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

Reproduce

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