Average Error: 28.5 → 17.0
Time: 21.6s
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 53.72772989939689125549193704500794410706:\\ \;\;\;\;\frac{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot \left(b \cdot b\right)}{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) + \left(b \cdot b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot b\right)}}{2}}{a}\\ \mathbf{elif}\;b \le 250.8081548127311179996468126773834228516:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 2125.07914601017046152264811098575592041:\\ \;\;\;\;\frac{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot \left(b \cdot b\right)}{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) + \left(b \cdot b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot b\right)}}{2}}{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 53.72772989939689125549193704500794410706:\\
\;\;\;\;\frac{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot \left(b \cdot b\right)}{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) + \left(b \cdot b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot b\right)}}{2}}{a}\\

\mathbf{elif}\;b \le 250.8081548127311179996468126773834228516:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \le 2125.07914601017046152264811098575592041:\\
\;\;\;\;\frac{\frac{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot \left(b \cdot b\right)}{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) + \left(b \cdot b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot b\right)}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r3233218 = b;
        double r3233219 = -r3233218;
        double r3233220 = r3233218 * r3233218;
        double r3233221 = 4.0;
        double r3233222 = a;
        double r3233223 = r3233221 * r3233222;
        double r3233224 = c;
        double r3233225 = r3233223 * r3233224;
        double r3233226 = r3233220 - r3233225;
        double r3233227 = sqrt(r3233226);
        double r3233228 = r3233219 + r3233227;
        double r3233229 = 2.0;
        double r3233230 = r3233229 * r3233222;
        double r3233231 = r3233228 / r3233230;
        return r3233231;
}

double f(double a, double b, double c) {
        double r3233232 = b;
        double r3233233 = 53.72772989939689;
        bool r3233234 = r3233232 <= r3233233;
        double r3233235 = r3233232 * r3233232;
        double r3233236 = 4.0;
        double r3233237 = a;
        double r3233238 = r3233236 * r3233237;
        double r3233239 = c;
        double r3233240 = r3233238 * r3233239;
        double r3233241 = r3233235 - r3233240;
        double r3233242 = sqrt(r3233241);
        double r3233243 = r3233242 * r3233241;
        double r3233244 = r3233232 * r3233235;
        double r3233245 = r3233243 - r3233244;
        double r3233246 = r3233242 * r3233232;
        double r3233247 = r3233235 + r3233246;
        double r3233248 = r3233241 + r3233247;
        double r3233249 = r3233245 / r3233248;
        double r3233250 = 2.0;
        double r3233251 = r3233249 / r3233250;
        double r3233252 = r3233251 / r3233237;
        double r3233253 = 250.80815481273112;
        bool r3233254 = r3233232 <= r3233253;
        double r3233255 = -1.0;
        double r3233256 = r3233239 / r3233232;
        double r3233257 = r3233255 * r3233256;
        double r3233258 = 2125.0791460101705;
        bool r3233259 = r3233232 <= r3233258;
        double r3233260 = r3233259 ? r3233252 : r3233257;
        double r3233261 = r3233254 ? r3233257 : r3233260;
        double r3233262 = r3233234 ? r3233252 : r3233261;
        return r3233262;
}

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 < 53.72772989939689 or 250.80815481273112 < b < 2125.0791460101705

    1. Initial program 17.3

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

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

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

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

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

    if 53.72772989939689 < b < 250.80815481273112 or 2125.0791460101705 < 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{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{2}}{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 simplification17.0

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

Reproduce

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