Average Error: 52.5 → 6.2
Time: 21.2s
Precision: 64
\[4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt a \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt b \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt c \lt 20282409603651670423947251286016\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[-1 \cdot \frac{c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
-1 \cdot \frac{c}{b}
double f(double a, double b, double c) {
        double r1581313 = b;
        double r1581314 = -r1581313;
        double r1581315 = r1581313 * r1581313;
        double r1581316 = 4.0;
        double r1581317 = a;
        double r1581318 = r1581316 * r1581317;
        double r1581319 = c;
        double r1581320 = r1581318 * r1581319;
        double r1581321 = r1581315 - r1581320;
        double r1581322 = sqrt(r1581321);
        double r1581323 = r1581314 + r1581322;
        double r1581324 = 2.0;
        double r1581325 = r1581324 * r1581317;
        double r1581326 = r1581323 / r1581325;
        return r1581326;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r1581327 = -1.0;
        double r1581328 = c;
        double r1581329 = b;
        double r1581330 = r1581328 / r1581329;
        double r1581331 = r1581327 * r1581330;
        return r1581331;
}

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. Initial program 52.5

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  4. Final simplification6.2

    \[\leadsto -1 \cdot \frac{c}{b}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))