Average Error: 28.3 → 16.6
Time: 15.1s
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 434.5586936141062892602349165827035903931:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot b}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + b}}{2 \cdot 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 434.5586936141062892602349165827035903931:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot b}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + b}}{2 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r28134 = b;
        double r28135 = -r28134;
        double r28136 = r28134 * r28134;
        double r28137 = 4.0;
        double r28138 = a;
        double r28139 = r28137 * r28138;
        double r28140 = c;
        double r28141 = r28139 * r28140;
        double r28142 = r28136 - r28141;
        double r28143 = sqrt(r28142);
        double r28144 = r28135 + r28143;
        double r28145 = 2.0;
        double r28146 = r28145 * r28138;
        double r28147 = r28144 / r28146;
        return r28147;
}

double f(double a, double b, double c) {
        double r28148 = b;
        double r28149 = 434.5586936141063;
        bool r28150 = r28148 <= r28149;
        double r28151 = r28148 * r28148;
        double r28152 = 4.0;
        double r28153 = a;
        double r28154 = r28152 * r28153;
        double r28155 = c;
        double r28156 = r28154 * r28155;
        double r28157 = r28151 - r28156;
        double r28158 = r28157 - r28151;
        double r28159 = sqrt(r28157);
        double r28160 = r28159 + r28148;
        double r28161 = r28158 / r28160;
        double r28162 = 2.0;
        double r28163 = r28162 * r28153;
        double r28164 = r28161 / r28163;
        double r28165 = -1.0;
        double r28166 = r28155 / r28148;
        double r28167 = r28165 * r28166;
        double r28168 = r28150 ? r28164 : r28167;
        return r28168;
}

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

    1. Initial program 16.4

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

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

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

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

    if 434.5586936141063 < b

    1. Initial program 35.0

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

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

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

Reproduce

herbie shell --seed 2019323 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :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)))