Average Error: 52.7 → 6.1
Time: 17.0s
Precision: 64
\[4.930380657631324 \cdot 10^{-32} \lt a \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt b \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt c \lt 2.028240960365167 \cdot 10^{+31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{-c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{-c}{b}
double f(double a, double b, double c) {
        double r311119 = b;
        double r311120 = -r311119;
        double r311121 = r311119 * r311119;
        double r311122 = 4.0;
        double r311123 = a;
        double r311124 = r311122 * r311123;
        double r311125 = c;
        double r311126 = r311124 * r311125;
        double r311127 = r311121 - r311126;
        double r311128 = sqrt(r311127);
        double r311129 = r311120 + r311128;
        double r311130 = 2.0;
        double r311131 = r311130 * r311123;
        double r311132 = r311129 / r311131;
        return r311132;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r311133 = c;
        double r311134 = -r311133;
        double r311135 = b;
        double r311136 = r311134 / r311135;
        return r311136;
}

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Taylor expanded around inf 6.1

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  3. Simplified6.1

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

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

Reproduce

herbie shell --seed 2019155 +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 a) c)))) (* 2 a)))