Average Error: 52.8 → 6.0
Time: 14.6s
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 r274460 = b;
        double r274461 = -r274460;
        double r274462 = r274460 * r274460;
        double r274463 = 4.0;
        double r274464 = a;
        double r274465 = r274463 * r274464;
        double r274466 = c;
        double r274467 = r274465 * r274466;
        double r274468 = r274462 - r274467;
        double r274469 = sqrt(r274468);
        double r274470 = r274461 + r274469;
        double r274471 = 2.0;
        double r274472 = r274471 * r274464;
        double r274473 = r274470 / r274472;
        return r274473;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r274474 = c;
        double r274475 = -r274474;
        double r274476 = b;
        double r274477 = r274475 / r274476;
        return r274477;
}

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

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

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

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

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

Reproduce

herbie shell --seed 2019128 +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)))