Average Error: 28.7 → 16.0
Time: 20.2s
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 455.6205576219001045501499902456998825073:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -1}{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 455.6205576219001045501499902456998825073:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r37619 = b;
        double r37620 = -r37619;
        double r37621 = r37619 * r37619;
        double r37622 = 4.0;
        double r37623 = a;
        double r37624 = r37622 * r37623;
        double r37625 = c;
        double r37626 = r37624 * r37625;
        double r37627 = r37621 - r37626;
        double r37628 = sqrt(r37627);
        double r37629 = r37620 + r37628;
        double r37630 = 2.0;
        double r37631 = r37630 * r37623;
        double r37632 = r37629 / r37631;
        return r37632;
}

double f(double a, double b, double c) {
        double r37633 = b;
        double r37634 = 455.6205576219001;
        bool r37635 = r37633 <= r37634;
        double r37636 = r37633 * r37633;
        double r37637 = 4.0;
        double r37638 = c;
        double r37639 = a;
        double r37640 = r37638 * r37639;
        double r37641 = r37637 * r37640;
        double r37642 = r37636 - r37641;
        double r37643 = r37642 - r37636;
        double r37644 = sqrt(r37642);
        double r37645 = r37633 + r37644;
        double r37646 = r37643 / r37645;
        double r37647 = 2.0;
        double r37648 = r37646 / r37647;
        double r37649 = r37648 / r37639;
        double r37650 = -1.0;
        double r37651 = r37638 * r37650;
        double r37652 = r37651 / r37633;
        double r37653 = r37635 ? r37649 : r37652;
        return r37653;
}

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

    1. Initial program 16.2

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

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

      \[\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}}}{2}}{a}\]
    5. Simplified15.2

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

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

    if 455.6205576219001 < b

    1. Initial program 36.0

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
    4. Simplified16.5

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

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

Reproduce

herbie shell --seed 2019196 
(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.0 a) c)))) (* 2.0 a)))