Average Error: 28.5 → 16.3
Time: 17.0s
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 1685.6454217574617:\\ \;\;\;\;\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 + \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}\right) \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + b \cdot b}}{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 1685.6454217574617:\\
\;\;\;\;\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 + \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}\right) \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + b \cdot b}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1116728 = b;
        double r1116729 = -r1116728;
        double r1116730 = r1116728 * r1116728;
        double r1116731 = 4.0;
        double r1116732 = a;
        double r1116733 = r1116731 * r1116732;
        double r1116734 = c;
        double r1116735 = r1116733 * r1116734;
        double r1116736 = r1116730 - r1116735;
        double r1116737 = sqrt(r1116736);
        double r1116738 = r1116729 + r1116737;
        double r1116739 = 2.0;
        double r1116740 = r1116739 * r1116732;
        double r1116741 = r1116738 / r1116740;
        return r1116741;
}

double f(double a, double b, double c) {
        double r1116742 = b;
        double r1116743 = 1685.6454217574617;
        bool r1116744 = r1116742 <= r1116743;
        double r1116745 = r1116742 * r1116742;
        double r1116746 = c;
        double r1116747 = a;
        double r1116748 = r1116746 * r1116747;
        double r1116749 = -4.0;
        double r1116750 = r1116748 * r1116749;
        double r1116751 = r1116745 + r1116750;
        double r1116752 = sqrt(r1116751);
        double r1116753 = r1116751 * r1116752;
        double r1116754 = r1116745 * r1116742;
        double r1116755 = r1116753 - r1116754;
        double r1116756 = r1116742 + r1116752;
        double r1116757 = r1116756 * r1116752;
        double r1116758 = r1116757 + r1116745;
        double r1116759 = r1116755 / r1116758;
        double r1116760 = r1116759 / r1116747;
        double r1116761 = 2.0;
        double r1116762 = r1116760 / r1116761;
        double r1116763 = -2.0;
        double r1116764 = r1116746 / r1116742;
        double r1116765 = r1116763 * r1116764;
        double r1116766 = r1116765 / r1116761;
        double r1116767 = r1116744 ? r1116762 : r1116766;
        return r1116767;
}

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

    1. Initial program 17.4

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

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

      \[\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. Simplified16.8

      \[\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) - 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. Simplified16.8

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

    if 1685.6454217574617 < b

    1. Initial program 36.7

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

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

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

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

Reproduce

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